public class JvmTypesBuilder
extends java.lang.Object
TypesPackage
).
It's meant to be used from an implementation of IJvmModelInferrer
.Constructor and Description |
---|
JvmTypesBuilder() |
Modifier and Type | Method and Description |
---|---|
void |
addAnnotation(JvmAnnotationTarget target,
XAnnotation annotation)
Translates an
XAnnotation to a JvmAnnotationReference
and adds them to the given JvmAnnotationTarget . |
void |
addAnnotations(JvmAnnotationTarget target,
java.lang.Iterable<? extends XAnnotation> annotations)
|
JvmTypeReference |
addArrayTypeDimension(JvmTypeReference componentType) |
<T extends org.eclipse.emf.ecore.EObject> |
associate(org.eclipse.emf.ecore.EObject sourceElement,
T target)
Associates a source element with a target element.
|
protected <T extends org.eclipse.emf.ecore.EObject> |
cloneAndAssociate(T original)
Creates a deep copy of the given object and associates each copied instance with the
clone.
|
protected <T extends JvmTypeReference> |
cloneAndAssociate(T original)
Creates a deep copy of the given object and associates each copied instance with the
clone.
|
JvmTypeReference |
cloneWithProxies(JvmTypeReference typeRef)
Creates a clone of the given
JvmTypeReference without resolving any proxies. |
<T extends JvmIdentifiableElement> |
cloneWithProxies(T original)
Creates a clone of the given
JvmIdentifiableElement without resolving any proxies. |
void |
copyDocumentationTo(org.eclipse.emf.ecore.EObject source,
JvmIdentifiableElement jvmElement)
Attaches the given documentation of the source element to the given jvmElement.
|
protected JvmGenericType |
createJvmGenericType(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name) |
java.lang.String |
getDocumentation(org.eclipse.emf.ecore.EObject source)
Retrieves the attached documentation for the given source element.
|
XExpression |
getExpression(JvmMember member)
Looks up and returns a logically contained expression.
|
XExpression |
getInitializer(JvmMember member)
Deprecated.
use
getExpression(JvmMember) instead |
JvmAnnotationReference |
getJvmAnnotationReference(XAnnotation anno)
Translates a single
XAnnotation to JvmAnnotationReference that can be added to a JvmAnnotationTarget . |
JvmTypeReference |
inferredType()
Produces an inferred type which will be resolved on demand.
|
JvmTypeReference |
inferredType(XExpression expression)
Produces an inferred type which will be resolved on demand.
|
protected <T extends org.eclipse.emf.ecore.EObject> |
initializeSafely(T targetElement,
Procedures.Procedure1<? super T> initializer) |
protected void |
internalSetExtension(JvmAnnotationTarget annotationTarget,
org.eclipse.emf.ecore.EObject sourceElement,
boolean value) |
protected boolean |
isPrimitiveBoolean(JvmTypeReference typeRef)
Detects whether the type reference refers to primitive boolean.
|
protected boolean |
isValidSource(org.eclipse.emf.ecore.EObject sourceElement) |
JvmTypeReference |
newTypeRef(org.eclipse.emf.ecore.EObject ctx,
java.lang.Class<?> clazz,
JvmTypeReference... typeArgs)
Deprecated.
|
JvmTypeReference |
newTypeRef(org.eclipse.emf.ecore.EObject ctx,
java.lang.String typeName,
JvmTypeReference... typeArgs)
Deprecated.
|
JvmTypeReference |
newTypeRef(JvmType type,
JvmTypeReference... typeArgs)
Deprecated.
|
<T> boolean |
operator_add(org.eclipse.emf.common.util.EList<? super T> list,
java.lang.Iterable<? extends T> elements)
Overrides the default
operator_add() to ignore null elements. |
<T> boolean |
operator_add(org.eclipse.emf.common.util.EList<? super T> list,
T element)
Overrides the default
operator_add() to ignore null elements. |
void |
removeExistingBody(JvmMember member)
Detaches any existing bodies from the
JvmMember . |
void |
setBody(JvmExecutable executable,
Procedures.Procedure1<ITreeAppendable> strategy)
Attaches the given compile strategy to the given
JvmExecutable such that the compiler knows how to
implement the JvmExecutable when it is translated to Java source code. |
void |
setBody(JvmExecutable executable,
StringConcatenationClient strategy)
Attaches the given compile strategy to the given
JvmExecutable such that the compiler knows how to
implement the JvmExecutable when it is translated to Java source code. |
void |
setBody(JvmExecutable logicalContainer,
XExpression expr)
Sets the given
JvmExecutable as the logical container for the given XExpression . |
protected void |
setCompilationStrategy(JvmMember member,
Procedures.Procedure1<ITreeAppendable> strategy) |
protected void |
setCompilationStrategy(JvmMember member,
StringConcatenationClient strategy) |
void |
setDocumentation(JvmIdentifiableElement jvmElement,
java.lang.String documentation)
Attaches the given documentation to the given jvmElement.
|
void |
setExtension(JvmField field,
org.eclipse.emf.ecore.EObject sourceElement,
boolean value)
Adds or removes the annotation
@Extension from the given field. |
void |
setExtension(JvmFormalParameter parameter,
org.eclipse.emf.ecore.EObject sourceElement,
boolean value)
Adds or removes the annotation
@Extension from the given parameter. |
void |
setFileHeader(JvmDeclaredType jvmDeclaredType,
java.lang.String headerText)
Attaches the given headText to the given
JvmDeclaredType . |
void |
setInitializer(JvmField field,
Procedures.Procedure1<ITreeAppendable> strategy)
|
void |
setInitializer(JvmField field,
StringConcatenationClient strategy)
|
void |
setInitializer(JvmField field,
XExpression expr)
Sets the given
JvmField as the logical container for the given XExpression . |
protected Pair<java.lang.String,java.lang.String> |
splitQualifiedName(java.lang.String name) |
JvmAnnotationReference |
toAnnotation(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.Class<?> annotationType)
Deprecated.
|
JvmAnnotationReference |
toAnnotation(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.Class<?> annotationType,
java.lang.Object value)
Deprecated.
|
JvmAnnotationReference |
toAnnotation(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String annotationTypeName)
Deprecated.
|
JvmAnnotationReference |
toAnnotation(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String annotationTypeName,
java.lang.Object value)
Deprecated.
|
JvmAnnotationType |
toAnnotationType(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name)
Creates a public annotation declaration, associated to the given sourceElement.
|
JvmAnnotationType |
toAnnotationType(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
Procedures.Procedure1<? super JvmAnnotationType> initializer)
Creates a public annotation declaration, associated to the given sourceElement.
|
JvmGenericType |
toClass(org.eclipse.emf.ecore.EObject sourceElement,
QualifiedName name)
Creates a public class declaration, associated to the given sourceElement.
|
JvmGenericType |
toClass(org.eclipse.emf.ecore.EObject sourceElement,
QualifiedName name,
Procedures.Procedure1<? super JvmGenericType> initializer)
Creates a public class declaration, associated to the given sourceElement.
|
JvmGenericType |
toClass(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name)
Creates a public class declaration, associated to the given sourceElement.
|
JvmGenericType |
toClass(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
Procedures.Procedure1<? super JvmGenericType> initializer)
Creates a public class declaration, associated to the given sourceElement.
|
JvmConstructor |
toConstructor(org.eclipse.emf.ecore.EObject sourceElement,
Procedures.Procedure1<? super JvmConstructor> initializer)
Creates and returns a constructor with the given simple name associated to the given source element.
|
JvmEnumerationLiteral |
toEnumerationLiteral(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name)
Creates a public enumeration literal, associated to the given sourceElement.
|
JvmEnumerationLiteral |
toEnumerationLiteral(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
Procedures.Procedure1<? super JvmEnumerationLiteral> initializer)
Same as
toEnumerationLiteral(EObject, String) but with an initializer passed as the last argument. |
JvmEnumerationType |
toEnumerationType(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name)
Creates a public enum declaration, associated to the given sourceElement.
|
JvmEnumerationType |
toEnumerationType(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
Procedures.Procedure1<? super JvmEnumerationType> initializer)
Creates a public enum declaration, associated to the given sourceElement.
|
JvmOperation |
toEqualsMethod(org.eclipse.emf.ecore.EObject sourceElement,
JvmDeclaredType declaredType,
boolean isDelegateToSuperEquals)
Deprecated.
build your own :-)
|
JvmOperation |
toEqualsMethod(org.eclipse.emf.ecore.EObject sourceElement,
JvmDeclaredType declaredType,
boolean isDelegateToSuperEquals,
JvmField... jvmFields)
Deprecated.
build your own :-)
|
JvmField |
toField(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
JvmTypeReference typeRef)
Creates a private field with the given name and the given type associated to the given sourceElement.
|
JvmField |
toField(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
JvmTypeReference typeRef,
Procedures.Procedure1<? super JvmField> initializer)
Same as
toField(EObject, String, JvmTypeReference) but with an initializer passed as the last argument. |
JvmOperation |
toGetter(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
JvmTypeReference typeRef)
shorthand for
toGetter(sourceElement, name, name, typeRef) . |
JvmOperation |
toGetter(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String propertyName,
java.lang.String fieldName,
JvmTypeReference typeRef)
Creates a getter method for the given property name and the field name.
|
JvmOperation |
toHashCodeMethod(org.eclipse.emf.ecore.EObject sourceElement,
boolean extendsSomethingWithProperHashCode,
JvmDeclaredType declaredType)
Deprecated.
build your own :-)
|
JvmOperation |
toHashCodeMethod(org.eclipse.emf.ecore.EObject sourceElement,
boolean extendsSomethingWithProperHashCode,
JvmField... jvmFields)
Deprecated.
build your own :-)
|
JvmGenericType |
toInterface(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
Procedures.Procedure1<? super JvmGenericType> initializer)
Creates a public interface declaration, associated to the given sourceElement.
|
JvmAnnotationValue |
toJvmAnnotationValue(XExpression value)
Removes the given expression from its current logical container and creates a
fresh detached
JvmAnnotationValue , that needs to be put into some JvmAnnotationReference |
JvmOperation |
toMethod(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
JvmTypeReference returnType,
Procedures.Procedure1<? super JvmOperation> initializer)
Creates a public method with the given name and the given return type and associates it with the given
sourceElement.
|
JvmFormalParameter |
toParameter(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
JvmTypeReference typeRef)
Creates and returns a formal parameter for the given name and type, which is associated to the given source
element.
|
JvmOperation |
toSetter(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
JvmTypeReference typeRef)
shorthand for
toSetter(sourceElement, name, name, typeRef) |
JvmOperation |
toSetter(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String propertyName,
java.lang.String fieldName,
JvmTypeReference typeRef)
Creates a setter method for the given properties name with the standard implementation assigning the passed
parameter to a similarly named field.
|
JvmOperation |
toToStringMethod(org.eclipse.emf.ecore.EObject sourceElement,
JvmDeclaredType declaredType)
Creates a
toString() method accumulating the values of all fields. |
void |
translateAnnotationsTo(java.lang.Iterable<? extends XAnnotation> annotations,
JvmAnnotationTarget target)
Deprecated.
use
addAnnotations(JvmAnnotationTarget, Iterable) instead |
public <T> boolean operator_add(org.eclipse.emf.common.util.EList<? super T> list, T element)
operator_add()
to ignore null
elements.public <T> boolean operator_add(org.eclipse.emf.common.util.EList<? super T> list, java.lang.Iterable<? extends T> elements)
operator_add()
to ignore null
elements.public void setBody(JvmExecutable logicalContainer, XExpression expr)
JvmExecutable
as the logical container for the given XExpression
.
This defines the context and the scope for the given expression. Also it defines how the given JvmExecutable can be executed.
For instance JvmModelGenerator
automatically translates any given XExpression
into corresponding Java source code as the body of the given JvmExecutable
.logicalContainer
- the JvmExecutable
the expression is associated with. Can be null
in which case this
function does nothing.expr
- the expression. Can be null
in which case this function does nothing.public void removeExistingBody(JvmMember member)
JvmMember
.
A body could be a logically container XExpression
or a
black box compilation strategy.member
- the member to remove the body frompublic XExpression getExpression(JvmMember member)
member
- the member containing the expressionnull
if no expression is contained.@Deprecated public XExpression getInitializer(JvmMember member)
getExpression(JvmMember)
insteadprotected <T extends org.eclipse.emf.ecore.EObject> T initializeSafely(T targetElement, Procedures.Procedure1<? super T> initializer)
public void setBody(JvmExecutable executable, Procedures.Procedure1<ITreeAppendable> strategy)
JvmExecutable
such that the compiler knows how to
implement the JvmExecutable
when it is translated to Java source code.executable
- the operation or constructor to add the method body to. If null
this method does nothing.strategy
- the compilation strategy. If null
this method does nothing.public void setBody(JvmExecutable executable, StringConcatenationClient strategy)
JvmExecutable
such that the compiler knows how to
implement the JvmExecutable
when it is translated to Java source code.executable
- the operation or constructor to add the method body to. If null
this method does nothing.strategy
- the compilation strategy. If null
this method does nothing.public java.lang.String getDocumentation(org.eclipse.emf.ecore.EObject source)
null
if source is null
or doesn't have any documentation.public void setDocumentation(JvmIdentifiableElement jvmElement, java.lang.String documentation)
public void copyDocumentationTo(org.eclipse.emf.ecore.EObject source, JvmIdentifiableElement jvmElement)
public void setFileHeader(JvmDeclaredType jvmDeclaredType, java.lang.String headerText)
JvmDeclaredType
.public JvmGenericType toClass(org.eclipse.emf.ecore.EObject sourceElement, QualifiedName name)
sourceElement
- the sourceElement the resulting element is associated with.name
- the qualifiedName of the resulting class.JvmGenericType
representing a Java class of the given name, null
if either parameter is null
.public JvmGenericType toClass(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name)
sourceElement
- the sourceElement the resulting element is associated with.name
- the qualifiedName of the resulting class.JvmGenericType
representing a Java class of the given name, null
if either parameter is null
.public JvmGenericType toClass(org.eclipse.emf.ecore.EObject sourceElement, QualifiedName name, Procedures.Procedure1<? super JvmGenericType> initializer)
sourceElement
- the sourceElement the resulting element is associated with.name
- the QualifiedName
of the resulting class.initializer
- the initializer to apply on the created class element. If null
, the class won't be initialized.JvmGenericType
representing a Java class of the given name, null
if sourceElement or name are null
.public JvmGenericType toClass(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name, Procedures.Procedure1<? super JvmGenericType> initializer)
sourceElement
- the sourceElement the resulting element is associated with.name
- the qualified name of the resulting class.initializer
- the initializer to apply on the created class element. If null
, the class won't be initialized.JvmGenericType
representing a Java class of the given name, null
if sourceElement or name are null
.public JvmGenericType toInterface(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name, Procedures.Procedure1<? super JvmGenericType> initializer)
sourceElement
- the sourceElement the resulting element is associated with.name
- the qualified name of the resulting class.initializer
- the initializer to apply on the created interface element. If null
, the interface won't be initialized.JvmGenericType
representing a Java class of the given name, null
if sourceElement or name are null
.public JvmAnnotationType toAnnotationType(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name)
sourceElement
- the sourceElement the resulting element is associated with.name
- the qualified name of the resulting class.JvmAnnotationType
representing a Java annotation of the given name, null
if sourceElement or name are null
.public JvmAnnotationType toAnnotationType(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name, Procedures.Procedure1<? super JvmAnnotationType> initializer)
sourceElement
- the sourceElement the resulting element is associated with.name
- the qualified name of the resulting class.initializer
- the initializer to apply on the created annotation. If null
, the annotation won't be initialized.JvmAnnotationType
representing a Java annotation of the given name, null
if sourceElement or name are null
.public JvmEnumerationType toEnumerationType(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name)
sourceElement
- the sourceElement the resulting element is associated with.name
- the qualified name of the resulting enum type.null
if sourceElement or name are null
.public JvmEnumerationType toEnumerationType(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name, Procedures.Procedure1<? super JvmEnumerationType> initializer)
sourceElement
- the sourceElement the resulting element is associated with.name
- the qualified name of the resulting enum type.initializer
- the initializer to apply on the created enumeration type. If null
, the enum won't be initialized.null
if sourceElement or name are null
.public JvmEnumerationLiteral toEnumerationLiteral(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name)
sourceElement
- the sourceElement the resulting element is associated with.name
- the simple name of the resulting enumeration literal.null
if sourceElement or name are null
.public JvmEnumerationLiteral toEnumerationLiteral(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name, Procedures.Procedure1<? super JvmEnumerationLiteral> initializer)
toEnumerationLiteral(EObject, String)
but with an initializer passed as the last argument.protected JvmGenericType createJvmGenericType(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name)
protected Pair<java.lang.String,java.lang.String> splitQualifiedName(java.lang.String name)
public JvmField toField(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name, JvmTypeReference typeRef)
sourceElement
- the sourceElement the resulting element is associated with.name
- the simple name of the resulting field.typeRef
- the type of the fieldJvmField
representing a Java field with the given simple name and type.public JvmField toField(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name, JvmTypeReference typeRef, Procedures.Procedure1<? super JvmField> initializer)
toField(EObject, String, JvmTypeReference)
but with an initializer passed as the last argument.public void setExtension(JvmField field, org.eclipse.emf.ecore.EObject sourceElement, boolean value)
@Extension
from the given field. If the annotation is
already present, nothing is done if value
is true
. If it is not present and value
is false
, this is a no-op, too.field
- the field that will be processedsourceElement
- the context that shall be used to lookup the annotation type
.value
- true
if the parameter shall be marked as extension, false
if it should be unmarked.public void setExtension(JvmFormalParameter parameter, org.eclipse.emf.ecore.EObject sourceElement, boolean value)
@Extension
from the given parameter. If the annotation is
already present, nothing is done if value
is true
. If it is not present and value
is false
, this is a no-op, too.parameter
- the parameter that will be processedsourceElement
- the context that shall be used to lookup the annotation type
.value
- true
if the parameter shall be marked as extension, false
if it should be unmarked.protected void internalSetExtension(JvmAnnotationTarget annotationTarget, org.eclipse.emf.ecore.EObject sourceElement, boolean value)
public <T extends org.eclipse.emf.ecore.EObject> T associate(org.eclipse.emf.ecore.EObject sourceElement, T target)
IJvmModelAssociator
,
IJvmModelAssociations
protected boolean isValidSource(org.eclipse.emf.ecore.EObject sourceElement)
public JvmOperation toMethod(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name, JvmTypeReference returnType, Procedures.Procedure1<? super JvmOperation> initializer)
sourceElement
- the sourceElement the method should be associated with.name
- the simple name of the method to be created.returnType
- the return type of the created method.initializer
- the initializer to apply on the created method. If null
, the method won't be initialized.null
if sourceElement or name are null
.public JvmTypeReference inferredType()
public JvmTypeReference inferredType(XExpression expression)
expression
- the expression that will be used resolve the type. May not be null
.public JvmOperation toGetter(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name, JvmTypeReference typeRef)
toGetter(sourceElement, name, name, typeRef)
.public JvmOperation toGetter(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String propertyName, java.lang.String fieldName, JvmTypeReference typeRef)
public String getPropertyName() {
return this.fieldName;
}
null
if sourceElement or name are null
.protected boolean isPrimitiveBoolean(JvmTypeReference typeRef)
public JvmOperation toSetter(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name, JvmTypeReference typeRef)
toSetter(sourceElement, name, name, typeRef)
public JvmOperation toSetter(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String propertyName, java.lang.String fieldName, JvmTypeReference typeRef)
public void setFoo(String foo) {
this.foo = foo;
}
null
if sourceElement or name are null
.public JvmFormalParameter toParameter(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name, JvmTypeReference typeRef)
null
if sourceElement or name are null
.public JvmConstructor toConstructor(org.eclipse.emf.ecore.EObject sourceElement, Procedures.Procedure1<? super JvmConstructor> initializer)
sourceElement
- the sourceElement the constructor should be associated with.initializer
- the initializer to apply on the created constructor. If null
, the method won't be initialized.null
if sourceElement is null
.public JvmOperation toToStringMethod(org.eclipse.emf.ecore.EObject sourceElement, JvmDeclaredType declaredType)
toString()
method accumulating the values of all fields.null
if sourceElement or declaredType are null
.@Deprecated public JvmOperation toHashCodeMethod(org.eclipse.emf.ecore.EObject sourceElement, boolean extendsSomethingWithProperHashCode, JvmDeclaredType declaredType)
@Deprecated public JvmOperation toHashCodeMethod(org.eclipse.emf.ecore.EObject sourceElement, boolean extendsSomethingWithProperHashCode, JvmField... jvmFields)
@Deprecated public JvmOperation toEqualsMethod(org.eclipse.emf.ecore.EObject sourceElement, JvmDeclaredType declaredType, boolean isDelegateToSuperEquals)
@Deprecated public JvmOperation toEqualsMethod(org.eclipse.emf.ecore.EObject sourceElement, JvmDeclaredType declaredType, boolean isDelegateToSuperEquals, JvmField... jvmFields)
@Deprecated public JvmAnnotationReference toAnnotation(org.eclipse.emf.ecore.EObject sourceElement, java.lang.Class<?> annotationType)
JvmAnnotationReferenceBuilder.annotationRef(Class, String...)
insteadtoAnnotation(EObject, Class, Object)
@Deprecated public JvmAnnotationReference toAnnotation(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String annotationTypeName)
JvmAnnotationReferenceBuilder.annotationRef(String, String...)
instead@Deprecated public JvmAnnotationReference toAnnotation(org.eclipse.emf.ecore.EObject sourceElement, java.lang.Class<?> annotationType, java.lang.Object value)
JvmAnnotationReferenceBuilder.annotationRef(Class, String...)
insteadsourceElement
- the source element to associate the created element with.annotationType
- the type of the created annotation reference.value
- the value of the annotation reference. Can be null
if the reference doesn't have any value.null if
sourceElement or annotationType are null
.
@Deprecated public JvmAnnotationReference toAnnotation(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String annotationTypeName, java.lang.Object value)
JvmAnnotationReferenceBuilder.annotationRef(String, String...)
insteadsourceElement
- the source element to associate the created element with.annotationTypeName
- the type name of the created annotation.value
- the value of the annotation reference. Can be null
if the reference doesn't have any value.null if
sourceElement or annotationType are null
.
public JvmTypeReference cloneWithProxies(JvmTypeReference typeRef)
JvmTypeReference
without resolving any proxies.
The clone will be associated with the original element by means of associations
.typeRef
- the type reference to be cloned.null
if typeRef is null
or a JvmUnknownTypeReference
if there is a problem with the typeRef.public <T extends JvmIdentifiableElement> T cloneWithProxies(T original)
JvmIdentifiableElement
without resolving any proxies.
The clone will be associated with the original element by means of associations
.original
- the element to be cloned.null
if original is null
.protected <T extends org.eclipse.emf.ecore.EObject> T cloneAndAssociate(T original)
original
- the root element to be cloned.null
if original is null
.protected <T extends JvmTypeReference> T cloneAndAssociate(T original)
original
- the root element to be cloned.null
if original is null
.public void setInitializer(JvmField field, Procedures.Procedure1<ITreeAppendable> strategy)
JvmField
such that the compiler knows how to
initialize the JvmField
when it is translated to Java source code.field
- the field to add the initializer to. If null
this method does nothing.strategy
- the compilation strategy. If null
this method does nothing.public void setInitializer(JvmField field, StringConcatenationClient strategy)
JvmField
such that the compiler knows how to
initialize the JvmField
when it is translated to Java source code.field
- the field to add the initializer to. If null
this method does nothing.strategy
- the compilation strategy. If null
this method does nothing.public void setInitializer(JvmField field, XExpression expr)
JvmField
as the logical container for the given XExpression
.
This defines the context and the scope for the given expression.field
- the JvmField
that is initialized by the expression. If null
this method does nothing.expr
- the initialization expression. Can be null
in which case this function does nothing.protected void setCompilationStrategy(JvmMember member, Procedures.Procedure1<ITreeAppendable> strategy)
protected void setCompilationStrategy(JvmMember member, StringConcatenationClient strategy)
@Deprecated public JvmTypeReference newTypeRef(org.eclipse.emf.ecore.EObject ctx, java.lang.Class<?> clazz, JvmTypeReference... typeArgs)
JvmTypeReferenceBuilder.typeRef(Class, JvmTypeReference...)
JvmTypeReference
pointing to the given class and containing the given type arguments.ctx
- an EMF context, which is used to look up the JvmType
for the
given clazz.clazz
- the class the type reference shall point to.typeArgs
- type argumentsJvmTypeReference
@Deprecated public JvmTypeReference newTypeRef(org.eclipse.emf.ecore.EObject ctx, java.lang.String typeName, JvmTypeReference... typeArgs)
JvmTypeReferenceBuilder.typeRef(String, JvmTypeReference...)
JvmTypeReference
pointing to the given class and containing the given type arguments.ctx
- an EMF context, which is used to look up the JvmType
for the
given clazz.typeName
- the name of the type the reference shall point to.typeArgs
- type argumentsJvmTypeReference
@Deprecated public JvmTypeReference newTypeRef(JvmType type, JvmTypeReference... typeArgs)
JvmTypeReferenceBuilder.typeRef(JvmType, JvmTypeReference...)
JvmTypeReference
pointing to the given class and containing the given type arguments.type
- the type the reference shall point to.typeArgs
- type argumentsJvmTypeReference
public JvmTypeReference addArrayTypeDimension(JvmTypeReference componentType)
JvmTypeReference
is
already an array.public void addAnnotations(JvmAnnotationTarget target, java.lang.Iterable<? extends XAnnotation> annotations)
target
- the annotation target. If null
this method does nothing.annotations
- the annotations. If null
this method does nothing.public void addAnnotation(JvmAnnotationTarget target, XAnnotation annotation)
XAnnotation
to a JvmAnnotationReference
and adds them to the given JvmAnnotationTarget
.target
- the annotation target. If null
this method does nothing.annotation
- the annotation. If null
this method does nothing.@Deprecated public void translateAnnotationsTo(java.lang.Iterable<? extends XAnnotation> annotations, JvmAnnotationTarget target)
addAnnotations(JvmAnnotationTarget, Iterable)
insteadtarget
- the annotation target. If null
this method does nothing.annotations
- the annotations. If null
this method does nothing.public JvmAnnotationReference getJvmAnnotationReference(XAnnotation anno)
XAnnotation
to JvmAnnotationReference
that can be added to a JvmAnnotationTarget
.anno
- the source annotationJvmAnnotationReference
that can be attached to some JvmAnnotationTarget
public JvmAnnotationValue toJvmAnnotationValue(XExpression value)
JvmAnnotationValue
, that needs to be put into some JvmAnnotationReference
value
- the expression to use as annotation valueJvmAnnotationValue
that needs to be put into some JvmAnnotationReference