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(org.eclipse.xtext.common.types.JvmAnnotationTarget target,
XAnnotation annotation)
Translates an
XAnnotation to a JvmAnnotationReference
and adds them to the given JvmAnnotationTarget. |
void |
addAnnotations(org.eclipse.xtext.common.types.JvmAnnotationTarget target,
java.lang.Iterable<? extends XAnnotation> annotations)
|
org.eclipse.xtext.common.types.JvmTypeReference |
addArrayTypeDimension(org.eclipse.xtext.common.types.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 org.eclipse.xtext.common.types.JvmTypeReference> |
cloneAndAssociate(T original)
Creates a deep copy of the given object and associates each copied instance with the
clone.
|
org.eclipse.xtext.common.types.JvmTypeReference |
cloneWithProxies(org.eclipse.xtext.common.types.JvmTypeReference typeRef)
Creates a clone of the given
JvmTypeReference without resolving any proxies. |
<T extends org.eclipse.xtext.common.types.JvmIdentifiableElement> |
cloneWithProxies(T original)
Creates a clone of the given
JvmIdentifiableElement without resolving any proxies. |
void |
copyDocumentationTo(org.eclipse.emf.ecore.EObject source,
org.eclipse.xtext.common.types.JvmIdentifiableElement jvmElement)
Attaches the given documentation of the source element to the given jvmElement.
|
protected org.eclipse.xtext.common.types.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(org.eclipse.xtext.common.types.JvmMember member)
Looks up and returns a logically contained expression.
|
XExpression |
getInitializer(org.eclipse.xtext.common.types.JvmMember member)
Deprecated.
use
getExpression(JvmMember) instead |
org.eclipse.xtext.common.types.JvmAnnotationReference |
getJvmAnnotationReference(XAnnotation anno)
Translates a single
XAnnotation to JvmAnnotationReference that can be added to a JvmAnnotationTarget. |
org.eclipse.xtext.common.types.JvmTypeReference |
inferredType()
Produces an inferred type which will be resolved on demand.
|
org.eclipse.xtext.common.types.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,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super T> initializer) |
protected void |
internalSetExtension(org.eclipse.xtext.common.types.JvmAnnotationTarget annotationTarget,
org.eclipse.emf.ecore.EObject sourceElement,
boolean value) |
protected boolean |
isPrimitiveBoolean(org.eclipse.xtext.common.types.JvmTypeReference typeRef)
Detects whether the type reference refers to primitive boolean.
|
protected boolean |
isValidSource(org.eclipse.emf.ecore.EObject sourceElement) |
org.eclipse.xtext.common.types.JvmTypeReference |
newTypeRef(org.eclipse.emf.ecore.EObject ctx,
java.lang.Class<?> clazz,
org.eclipse.xtext.common.types.JvmTypeReference... typeArgs)
Deprecated.
|
org.eclipse.xtext.common.types.JvmTypeReference |
newTypeRef(org.eclipse.emf.ecore.EObject ctx,
java.lang.String typeName,
org.eclipse.xtext.common.types.JvmTypeReference... typeArgs)
Deprecated.
|
org.eclipse.xtext.common.types.JvmTypeReference |
newTypeRef(org.eclipse.xtext.common.types.JvmType type,
org.eclipse.xtext.common.types.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(org.eclipse.xtext.common.types.JvmMember member)
Detaches any existing bodies from the
JvmMember. |
void |
setBody(org.eclipse.xtext.common.types.JvmExecutable executable,
org.eclipse.xtext.xbase.lib.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(org.eclipse.xtext.common.types.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(org.eclipse.xtext.common.types.JvmExecutable logicalContainer,
XExpression expr)
Sets the given
JvmExecutable as the logical container for the given XExpression. |
protected void |
setCompilationStrategy(org.eclipse.xtext.common.types.JvmMember member,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<ITreeAppendable> strategy) |
protected void |
setCompilationStrategy(org.eclipse.xtext.common.types.JvmMember member,
org.eclipse.xtend2.lib.StringConcatenationClient strategy) |
void |
setDocumentation(org.eclipse.xtext.common.types.JvmIdentifiableElement jvmElement,
java.lang.String documentation)
Attaches the given documentation to the given jvmElement.
|
void |
setExtension(org.eclipse.xtext.common.types.JvmField field,
org.eclipse.emf.ecore.EObject sourceElement,
boolean value)
Adds or removes the annotation
@Extension from the given field. |
void |
setExtension(org.eclipse.xtext.common.types.JvmFormalParameter parameter,
org.eclipse.emf.ecore.EObject sourceElement,
boolean value)
Adds or removes the annotation
@Extension from the given parameter. |
void |
setFileHeader(org.eclipse.xtext.common.types.JvmDeclaredType jvmDeclaredType,
java.lang.String headerText)
Attaches the given headText to the given
JvmDeclaredType. |
void |
setInitializer(org.eclipse.xtext.common.types.JvmField field,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<ITreeAppendable> strategy)
Attaches the given compile strategy to the given
JvmField such that the compiler knows how to
initialize the JvmField when it is translated to Java source code. |
void |
setInitializer(org.eclipse.xtext.common.types.JvmField field,
org.eclipse.xtend2.lib.StringConcatenationClient strategy)
Attaches the given compile strategy to the given
JvmField such that the compiler knows how to
initialize the JvmField when it is translated to Java source code. |
void |
setInitializer(org.eclipse.xtext.common.types.JvmField field,
XExpression expr)
Sets the given
JvmField as the logical container for the given XExpression. |
protected org.eclipse.xtext.util.Pair<java.lang.String,java.lang.String> |
splitQualifiedName(java.lang.String name) |
org.eclipse.xtext.common.types.JvmAnnotationReference |
toAnnotation(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.Class<?> annotationType)
Deprecated.
|
org.eclipse.xtext.common.types.JvmAnnotationReference |
toAnnotation(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.Class<?> annotationType,
java.lang.Object value)
Deprecated.
|
org.eclipse.xtext.common.types.JvmAnnotationReference |
toAnnotation(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String annotationTypeName)
Deprecated.
|
org.eclipse.xtext.common.types.JvmAnnotationReference |
toAnnotation(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String annotationTypeName,
java.lang.Object value)
Deprecated.
|
org.eclipse.xtext.common.types.JvmAnnotationType |
toAnnotationType(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name)
Creates a public annotation declaration, associated to the given sourceElement.
|
org.eclipse.xtext.common.types.JvmAnnotationType |
toAnnotationType(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super org.eclipse.xtext.common.types.JvmAnnotationType> initializer)
Creates a public annotation declaration, associated to the given sourceElement.
|
org.eclipse.xtext.common.types.JvmGenericType |
toClass(org.eclipse.emf.ecore.EObject sourceElement,
org.eclipse.xtext.naming.QualifiedName name)
Creates a public class declaration, associated to the given sourceElement.
|
org.eclipse.xtext.common.types.JvmGenericType |
toClass(org.eclipse.emf.ecore.EObject sourceElement,
org.eclipse.xtext.naming.QualifiedName name,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super org.eclipse.xtext.common.types.JvmGenericType> initializer)
Creates a public class declaration, associated to the given sourceElement.
|
org.eclipse.xtext.common.types.JvmGenericType |
toClass(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name)
Creates a public class declaration, associated to the given sourceElement.
|
org.eclipse.xtext.common.types.JvmGenericType |
toClass(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super org.eclipse.xtext.common.types.JvmGenericType> initializer)
Creates a public class declaration, associated to the given sourceElement.
|
org.eclipse.xtext.common.types.JvmConstructor |
toConstructor(org.eclipse.emf.ecore.EObject sourceElement,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super org.eclipse.xtext.common.types.JvmConstructor> initializer)
Creates and returns a constructor with the given simple name associated to the given source element.
|
org.eclipse.xtext.common.types.JvmEnumerationLiteral |
toEnumerationLiteral(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name)
Creates a public enumeration literal, associated to the given sourceElement.
|
org.eclipse.xtext.common.types.JvmEnumerationLiteral |
toEnumerationLiteral(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super org.eclipse.xtext.common.types.JvmEnumerationLiteral> initializer)
Same as
toEnumerationLiteral(EObject, String) but with an initializer passed as the last argument. |
org.eclipse.xtext.common.types.JvmEnumerationType |
toEnumerationType(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name)
Creates a public enum declaration, associated to the given sourceElement.
|
org.eclipse.xtext.common.types.JvmEnumerationType |
toEnumerationType(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super org.eclipse.xtext.common.types.JvmEnumerationType> initializer)
Creates a public enum declaration, associated to the given sourceElement.
|
org.eclipse.xtext.common.types.JvmOperation |
toEqualsMethod(org.eclipse.emf.ecore.EObject sourceElement,
org.eclipse.xtext.common.types.JvmDeclaredType declaredType,
boolean isDelegateToSuperEquals)
Deprecated.
build your own :-)
|
org.eclipse.xtext.common.types.JvmOperation |
toEqualsMethod(org.eclipse.emf.ecore.EObject sourceElement,
org.eclipse.xtext.common.types.JvmDeclaredType declaredType,
boolean isDelegateToSuperEquals,
org.eclipse.xtext.common.types.JvmField... jvmFields)
Deprecated.
build your own :-)
|
org.eclipse.xtext.common.types.JvmField |
toField(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.common.types.JvmTypeReference typeRef)
Creates a private field with the given name and the given type associated to the given sourceElement.
|
org.eclipse.xtext.common.types.JvmField |
toField(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.common.types.JvmTypeReference typeRef,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super org.eclipse.xtext.common.types.JvmField> initializer)
Same as
toField(EObject, String, JvmTypeReference) but with an initializer passed as the last argument. |
org.eclipse.xtext.common.types.JvmOperation |
toGetter(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.common.types.JvmTypeReference typeRef)
shorthand for
toGetter(sourceElement, name, name, typeRef). |
org.eclipse.xtext.common.types.JvmOperation |
toGetter(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String propertyName,
java.lang.String fieldName,
org.eclipse.xtext.common.types.JvmTypeReference typeRef)
Creates a getter method for the given property name and the field name.
|
org.eclipse.xtext.common.types.JvmOperation |
toHashCodeMethod(org.eclipse.emf.ecore.EObject sourceElement,
boolean extendsSomethingWithProperHashCode,
org.eclipse.xtext.common.types.JvmDeclaredType declaredType)
Deprecated.
build your own :-)
|
org.eclipse.xtext.common.types.JvmOperation |
toHashCodeMethod(org.eclipse.emf.ecore.EObject sourceElement,
boolean extendsSomethingWithProperHashCode,
org.eclipse.xtext.common.types.JvmField... jvmFields)
Deprecated.
build your own :-)
|
org.eclipse.xtext.common.types.JvmGenericType |
toInterface(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super org.eclipse.xtext.common.types.JvmGenericType> initializer)
Creates a public interface declaration, associated to the given sourceElement.
|
org.eclipse.xtext.common.types.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 |
org.eclipse.xtext.common.types.JvmOperation |
toMethod(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.common.types.JvmTypeReference returnType,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super org.eclipse.xtext.common.types.JvmOperation> initializer)
Creates a public method with the given name and the given return type and associates it with the given
sourceElement.
|
org.eclipse.xtext.common.types.JvmFormalParameter |
toParameter(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.common.types.JvmTypeReference typeRef)
Creates and returns a formal parameter for the given name and type, which is associated to the given source
element.
|
org.eclipse.xtext.common.types.JvmOperation |
toSetter(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.common.types.JvmTypeReference typeRef)
shorthand for
toSetter(sourceElement, name, name, typeRef) |
org.eclipse.xtext.common.types.JvmOperation |
toSetter(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String propertyName,
java.lang.String fieldName,
org.eclipse.xtext.common.types.JvmTypeReference typeRef)
Creates a setter method for the given properties name with the standard implementation assigning the passed
parameter to a similarly named field.
|
org.eclipse.xtext.common.types.JvmOperation |
toToStringMethod(org.eclipse.emf.ecore.EObject sourceElement,
org.eclipse.xtext.common.types.JvmDeclaredType declaredType)
Creates a
toString() method accumulating the values of all fields. |
void |
translateAnnotationsTo(java.lang.Iterable<? extends XAnnotation> annotations,
org.eclipse.xtext.common.types.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(org.eclipse.xtext.common.types.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(org.eclipse.xtext.common.types.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(org.eclipse.xtext.common.types.JvmMember member)
member - the member containing the expressionnull if no expression is contained.@Deprecated public XExpression getInitializer(org.eclipse.xtext.common.types.JvmMember member)
getExpression(JvmMember) insteadprotected <T extends org.eclipse.emf.ecore.EObject> T initializeSafely(T targetElement,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super T> initializer)
public void setBody(org.eclipse.xtext.common.types.JvmExecutable executable,
org.eclipse.xtext.xbase.lib.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(org.eclipse.xtext.common.types.JvmExecutable executable,
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.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(org.eclipse.xtext.common.types.JvmIdentifiableElement jvmElement,
java.lang.String documentation)
public void copyDocumentationTo(org.eclipse.emf.ecore.EObject source,
org.eclipse.xtext.common.types.JvmIdentifiableElement jvmElement)
public void setFileHeader(org.eclipse.xtext.common.types.JvmDeclaredType jvmDeclaredType,
java.lang.String headerText)
JvmDeclaredType.public org.eclipse.xtext.common.types.JvmGenericType toClass(org.eclipse.emf.ecore.EObject sourceElement,
org.eclipse.xtext.naming.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 org.eclipse.xtext.common.types.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 org.eclipse.xtext.common.types.JvmGenericType toClass(org.eclipse.emf.ecore.EObject sourceElement,
org.eclipse.xtext.naming.QualifiedName name,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super org.eclipse.xtext.common.types.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 org.eclipse.xtext.common.types.JvmGenericType toClass(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super org.eclipse.xtext.common.types.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 org.eclipse.xtext.common.types.JvmGenericType toInterface(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super org.eclipse.xtext.common.types.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 org.eclipse.xtext.common.types.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 org.eclipse.xtext.common.types.JvmAnnotationType toAnnotationType(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super org.eclipse.xtext.common.types.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 org.eclipse.xtext.common.types.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 org.eclipse.xtext.common.types.JvmEnumerationType toEnumerationType(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super org.eclipse.xtext.common.types.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 org.eclipse.xtext.common.types.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 org.eclipse.xtext.common.types.JvmEnumerationLiteral toEnumerationLiteral(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super org.eclipse.xtext.common.types.JvmEnumerationLiteral> initializer)
toEnumerationLiteral(EObject, String) but with an initializer passed as the last argument.protected org.eclipse.xtext.common.types.JvmGenericType createJvmGenericType(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name)
protected org.eclipse.xtext.util.Pair<java.lang.String,java.lang.String> splitQualifiedName(java.lang.String name)
public org.eclipse.xtext.common.types.JvmField toField(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.common.types.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 org.eclipse.xtext.common.types.JvmField toField(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.common.types.JvmTypeReference typeRef,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super org.eclipse.xtext.common.types.JvmField> initializer)
toField(EObject, String, JvmTypeReference) but with an initializer passed as the last argument.public void setExtension(org.eclipse.xtext.common.types.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(org.eclipse.xtext.common.types.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(org.eclipse.xtext.common.types.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,
IJvmModelAssociationsprotected boolean isValidSource(org.eclipse.emf.ecore.EObject sourceElement)
public org.eclipse.xtext.common.types.JvmOperation toMethod(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.common.types.JvmTypeReference returnType,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super org.eclipse.xtext.common.types.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 org.eclipse.xtext.common.types.JvmTypeReference inferredType()
public org.eclipse.xtext.common.types.JvmTypeReference inferredType(XExpression expression)
expression - the expression that will be used resolve the type. May not be null.public org.eclipse.xtext.common.types.JvmOperation toGetter(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.common.types.JvmTypeReference typeRef)
toGetter(sourceElement, name, name, typeRef).public org.eclipse.xtext.common.types.JvmOperation toGetter(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String propertyName,
java.lang.String fieldName,
org.eclipse.xtext.common.types.JvmTypeReference typeRef)
public String getPropertyName() {
return this.fieldName;
}
null if sourceElement or name are null.protected boolean isPrimitiveBoolean(org.eclipse.xtext.common.types.JvmTypeReference typeRef)
public org.eclipse.xtext.common.types.JvmOperation toSetter(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.common.types.JvmTypeReference typeRef)
toSetter(sourceElement, name, name, typeRef)public org.eclipse.xtext.common.types.JvmOperation toSetter(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String propertyName,
java.lang.String fieldName,
org.eclipse.xtext.common.types.JvmTypeReference typeRef)
public void setFoo(String foo) {
this.foo = foo;
}
null if sourceElement or name are null.public org.eclipse.xtext.common.types.JvmFormalParameter toParameter(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
org.eclipse.xtext.common.types.JvmTypeReference typeRef)
null if sourceElement or name are null.public org.eclipse.xtext.common.types.JvmConstructor toConstructor(org.eclipse.emf.ecore.EObject sourceElement,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<? super org.eclipse.xtext.common.types.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 org.eclipse.xtext.common.types.JvmOperation toToStringMethod(org.eclipse.emf.ecore.EObject sourceElement,
org.eclipse.xtext.common.types.JvmDeclaredType declaredType)
toString() method accumulating the values of all fields.null if sourceElement or declaredType are null.@Deprecated
public org.eclipse.xtext.common.types.JvmOperation toHashCodeMethod(org.eclipse.emf.ecore.EObject sourceElement,
boolean extendsSomethingWithProperHashCode,
org.eclipse.xtext.common.types.JvmDeclaredType declaredType)
@Deprecated
public org.eclipse.xtext.common.types.JvmOperation toHashCodeMethod(org.eclipse.emf.ecore.EObject sourceElement,
boolean extendsSomethingWithProperHashCode,
org.eclipse.xtext.common.types.JvmField... jvmFields)
@Deprecated
public org.eclipse.xtext.common.types.JvmOperation toEqualsMethod(org.eclipse.emf.ecore.EObject sourceElement,
org.eclipse.xtext.common.types.JvmDeclaredType declaredType,
boolean isDelegateToSuperEquals)
@Deprecated
public org.eclipse.xtext.common.types.JvmOperation toEqualsMethod(org.eclipse.emf.ecore.EObject sourceElement,
org.eclipse.xtext.common.types.JvmDeclaredType declaredType,
boolean isDelegateToSuperEquals,
org.eclipse.xtext.common.types.JvmField... jvmFields)
@Deprecated
public org.eclipse.xtext.common.types.JvmAnnotationReference toAnnotation(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.Class<?> annotationType)
JvmAnnotationReferenceBuilder.annotationRef(Class, String...) insteadtoAnnotation(EObject, Class, Object)@Deprecated
public org.eclipse.xtext.common.types.JvmAnnotationReference toAnnotation(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String annotationTypeName)
JvmAnnotationReferenceBuilder.annotationRef(String, String...) insteadtoAnnotation(EObject, String, Object)@Deprecated
public org.eclipse.xtext.common.types.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 org.eclipse.xtext.common.types.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 org.eclipse.xtext.common.types.JvmTypeReference cloneWithProxies(org.eclipse.xtext.common.types.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 org.eclipse.xtext.common.types.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 org.eclipse.xtext.common.types.JvmTypeReference> T cloneAndAssociate(T original)
original - the root element to be cloned.null if original is null.public void setInitializer(org.eclipse.xtext.common.types.JvmField field,
org.eclipse.xtext.xbase.lib.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(org.eclipse.xtext.common.types.JvmField field,
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(org.eclipse.xtext.common.types.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(org.eclipse.xtext.common.types.JvmMember member,
org.eclipse.xtext.xbase.lib.Procedures.Procedure1<ITreeAppendable> strategy)
protected void setCompilationStrategy(org.eclipse.xtext.common.types.JvmMember member,
org.eclipse.xtend2.lib.StringConcatenationClient strategy)
@Deprecated
public org.eclipse.xtext.common.types.JvmTypeReference newTypeRef(org.eclipse.emf.ecore.EObject ctx,
java.lang.Class<?> clazz,
org.eclipse.xtext.common.types.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 org.eclipse.xtext.common.types.JvmTypeReference newTypeRef(org.eclipse.emf.ecore.EObject ctx,
java.lang.String typeName,
org.eclipse.xtext.common.types.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 org.eclipse.xtext.common.types.JvmTypeReference newTypeRef(org.eclipse.xtext.common.types.JvmType type,
org.eclipse.xtext.common.types.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 argumentsJvmTypeReferencepublic org.eclipse.xtext.common.types.JvmTypeReference addArrayTypeDimension(org.eclipse.xtext.common.types.JvmTypeReference componentType)
JvmTypeReference is
already an array.public void addAnnotations(org.eclipse.xtext.common.types.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(org.eclipse.xtext.common.types.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, org.eclipse.xtext.common.types.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 org.eclipse.xtext.common.types.JvmAnnotationReference getJvmAnnotationReference(XAnnotation anno)
XAnnotation to JvmAnnotationReference that can be added to a JvmAnnotationTarget.anno - the source annotationJvmAnnotationReference that can be attached to some JvmAnnotationTargetpublic org.eclipse.xtext.common.types.JvmAnnotationValue toJvmAnnotationValue(XExpression value)
JvmAnnotationValue, that needs to be put into some JvmAnnotationReferencevalue - the expression to use as annotation valueJvmAnnotationValue that needs to be put into some JvmAnnotationReference