@NonNullByDefault
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 |
---|---|
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. |
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) |
XExpression |
getInitializer(JvmMember member) |
JvmAnnotationReference |
getJvmAnnotationReference(XAnnotation anno) |
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) |
JvmTypeReference |
newTypeRef(org.eclipse.emf.ecore.EObject ctx,
java.lang.Class<?> clazz,
JvmTypeReference... typeArgs)
Creates a new
JvmTypeReference pointing to the given class and containing the given type arguments. |
JvmTypeReference |
newTypeRef(org.eclipse.emf.ecore.EObject ctx,
java.lang.String typeName,
JvmTypeReference... typeArgs)
Creates a new
JvmTypeReference pointing to the given class and containing the given type arguments. |
JvmTypeReference |
newTypeRef(JvmType type,
JvmTypeReference... typeArgs)
Creates a new
JvmTypeReference pointing to the given class and containing the given type arguments. |
<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) |
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,
org.eclipse.xtend2.lib.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,
org.eclipse.xtend2.lib.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,
org.eclipse.xtend2.lib.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)
Creates and returns an annotation reference of the given annotation type.
|
JvmAnnotationReference |
toAnnotation(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.Class<?> annotationType,
java.lang.Object value)
Creates and returns an annotation reference of the given annotation type's name and the given value.
|
JvmAnnotationReference |
toAnnotation(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String annotationTypeName)
Creates and returns an annotation reference of the given annotation type's name.
|
JvmAnnotationReference |
toAnnotation(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String annotationTypeName,
java.lang.Object value)
Creates and returns an annotation reference of the given annotation type's name and the given value.
|
JvmAnnotationType |
toAnnotationType(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name) |
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,
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) |
JvmOperation |
toEqualsMethod(org.eclipse.emf.ecore.EObject sourceElement,
JvmDeclaredType declaredType,
boolean isDelegateToSuperEquals,
JvmField... jvmFields) |
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) |
JvmOperation |
toHashCodeMethod(org.eclipse.emf.ecore.EObject sourceElement,
boolean extendsSomethingWithProperHashCode,
JvmField... jvmFields) |
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) |
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)
|
public <T> boolean operator_add(@Nullable org.eclipse.emf.common.util.EList<? super T> list, @Nullable T element)
operator_add()
to ignore null
elements.public <T> boolean operator_add(@Nullable org.eclipse.emf.common.util.EList<? super T> list, @Nullable java.lang.Iterable<? extends T> elements)
operator_add()
to ignore null
elements.public void setBody(@Nullable JvmExecutable logicalContainer, @Nullable 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(@Nullable JvmMember member)
@Nullable public XExpression getExpression(@Nullable JvmMember member)
@Nullable public XExpression getInitializer(@Nullable JvmMember member)
@Nullable protected <T extends org.eclipse.emf.ecore.EObject> T initializeSafely(@Nullable T targetElement, @Nullable Procedures.Procedure1<? super T> initializer)
public void setBody(@Nullable JvmExecutable executable, @Nullable 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(@Nullable JvmExecutable executable, @Nullable org.eclipse.xtend2.lib.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.@Nullable public java.lang.String getDocumentation(@Nullable org.eclipse.emf.ecore.EObject source)
null
if source is null
or doesn't have any documentation.public void setDocumentation(@Nullable JvmIdentifiableElement jvmElement, @Nullable java.lang.String documentation)
public void setFileHeader(@Nullable JvmDeclaredType jvmDeclaredType, @Nullable java.lang.String headerText)
JvmDeclaredType
.@Nullable public JvmGenericType toClass(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable 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
.@Nullable public JvmGenericType toClass(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable 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
.@Nullable public JvmGenericType toClass(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable QualifiedName name, @Nullable 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
.@Nullable public JvmGenericType toClass(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable java.lang.String name, @Nullable 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
.@Nullable public JvmGenericType toInterface(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable java.lang.String name, @Nullable 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
.@Nullable public JvmAnnotationType toAnnotationType(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable java.lang.String name)
@Nullable public JvmAnnotationType toAnnotationType(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable java.lang.String name, @Nullable 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
.@Nullable public JvmEnumerationType toEnumerationType(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable java.lang.String name, @Nullable 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
.@Nullable public JvmEnumerationLiteral toEnumerationLiteral(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable 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
.@Nullable public JvmEnumerationLiteral toEnumerationLiteral(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable java.lang.String name, @Nullable Procedures.Procedure1<? super JvmEnumerationLiteral> initializer)
toEnumerationLiteral(EObject, String)
but with an initializer passed as the last argument.@Nullable protected JvmGenericType createJvmGenericType(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable java.lang.String name)
protected Pair<java.lang.String,java.lang.String> splitQualifiedName(java.lang.String name)
@Nullable public JvmField toField(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable java.lang.String name, @Nullable 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.@Nullable public JvmField toField(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable java.lang.String name, @Nullable JvmTypeReference typeRef, @Nullable Procedures.Procedure1<? super JvmField> initializer)
toField(EObject, String, JvmTypeReference)
but with an initializer passed as the last argument.public void setExtension(@Nullable 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(@Nullable 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)
@Nullable public <T extends org.eclipse.emf.ecore.EObject> T associate(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable T target)
IJvmModelAssociator
,
IJvmModelAssociations
@Nullable public JvmOperation toMethod(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable java.lang.String name, @Nullable JvmTypeReference returnType, @Nullable 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
.@Nullable public JvmOperation toGetter(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable java.lang.String name, @Nullable JvmTypeReference typeRef)
toGetter(sourceElement, name, name, typeRef)
.@Nullable public JvmOperation toGetter(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable java.lang.String propertyName, @Nullable java.lang.String fieldName, @Nullable JvmTypeReference typeRef)
public String getPropertyName() {
return this.fieldName;
}
null
if sourceElement or name are null
.@Nullable public JvmOperation toSetter(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable java.lang.String name, @Nullable JvmTypeReference typeRef)
toSetter(sourceElement, name, name, typeRef)
@Nullable public JvmOperation toSetter(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable java.lang.String propertyName, @Nullable java.lang.String fieldName, @Nullable JvmTypeReference typeRef)
public void setFoo(String foo) {
this.foo = foo;
}
null
if sourceElement or name are null
.@Nullable public JvmFormalParameter toParameter(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable java.lang.String name, @Nullable JvmTypeReference typeRef)
null
if sourceElement or name are null
.@Nullable public JvmConstructor toConstructor(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable 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
.@Nullable public JvmOperation toToStringMethod(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable JvmDeclaredType declaredType)
toString()
method accumulating the values of all fields.null
if sourceElement or declaredType are null
.@Nullable public JvmOperation toHashCodeMethod(@Nullable org.eclipse.emf.ecore.EObject sourceElement, boolean extendsSomethingWithProperHashCode, @Nullable JvmDeclaredType declaredType)
@Nullable public JvmOperation toHashCodeMethod(@Nullable org.eclipse.emf.ecore.EObject sourceElement, boolean extendsSomethingWithProperHashCode, JvmField... jvmFields)
@Nullable public JvmOperation toEqualsMethod(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable JvmDeclaredType declaredType, boolean isDelegateToSuperEquals)
@Nullable public JvmOperation toEqualsMethod(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable JvmDeclaredType declaredType, boolean isDelegateToSuperEquals, JvmField... jvmFields)
@Nullable public JvmAnnotationReference toAnnotation(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable java.lang.Class<?> annotationType)
toAnnotation(EObject, Class, Object)
@Nullable public JvmAnnotationReference toAnnotation(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable java.lang.String annotationTypeName)
@Nullable public JvmAnnotationReference toAnnotation(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable java.lang.Class<?> annotationType, @Nullable java.lang.Object value)
sourceElement
- 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
.
@Nullable public JvmAnnotationReference toAnnotation(@Nullable org.eclipse.emf.ecore.EObject sourceElement, @Nullable java.lang.String annotationTypeName, @Nullable java.lang.Object value)
sourceElement
- 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
.
@Nullable public JvmTypeReference cloneWithProxies(@Nullable 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.@Nullable public <T extends JvmIdentifiableElement> T cloneWithProxies(@Nullable 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(@Nullable JvmField field, @Nullable 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(@Nullable JvmField field, @Nullable org.eclipse.xtend2.lib.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(@Nullable JvmField field, @Nullable 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(@Nullable JvmMember member, @Nullable Procedures.Procedure1<ITreeAppendable> strategy)
protected void setCompilationStrategy(@Nullable JvmMember member, @Nullable org.eclipse.xtend2.lib.StringConcatenationClient strategy)
@Nullable public JvmTypeReference newTypeRef(@Nullable org.eclipse.emf.ecore.EObject ctx, @Nullable java.lang.Class<?> clazz, @Nullable JvmTypeReference... typeArgs)
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
@Nullable public JvmTypeReference newTypeRef(@Nullable org.eclipse.emf.ecore.EObject ctx, @Nullable java.lang.String typeName, @Nullable JvmTypeReference... typeArgs)
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
@Nullable public JvmTypeReference newTypeRef(@Nullable JvmType type, @Nullable JvmTypeReference... typeArgs)
JvmTypeReference
pointing to the given class and containing the given type arguments.type
- the type the reference shall point to.typeArgs
- type argumentsJvmTypeReference
@Nullable public JvmTypeReference addArrayTypeDimension(@Nullable JvmTypeReference componentType)
JvmTypeReference
is
already an array.public void translateAnnotationsTo(@Nullable java.lang.Iterable<? extends XAnnotation> annotations, @Nullable JvmAnnotationTarget target)
target
- the annotation target. If null
this method does nothing.annotations
- the annotations. If null
this method does nothing.@Nullable public JvmAnnotationReference getJvmAnnotationReference(@Nullable XAnnotation anno)
@Nullable public JvmAnnotationValue toJvmAnnotationValue(@Nullable XExpression value)