|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.xtext.xbase.jvmmodel.JvmTypesBuilder
public class JvmTypesBuilder
A set of factory and builder functions, used to create an instance of the Jvm model (TypesPackage
).
Constructor Summary | |
---|---|
JvmTypesBuilder()
|
Method Summary | ||
---|---|---|
JvmTypeReference |
addArrayTypeDimension(JvmTypeReference componentType)
|
|
protected void |
addCompilationStrategy(JvmMember member,
Functions.Function1<ImportManager,? extends java.lang.CharSequence> strategy)
|
|
|
associate(org.eclipse.emf.ecore.EObject sourceElement,
T target)
Associates a source element with a target element. |
|
JvmTypeReference |
cloneWithProxies(JvmTypeReference typeRef)
Creates a clone of the given JvmTypeReference 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)
|
|
protected JvmAnnotationReference |
getJvmAnnotationReference(XAnnotation anno)
|
|
protected JvmAnnotationValue |
getJvmAnnotationValue(XExpression value)
|
|
void |
initialization(JvmField field,
Functions.Function1<ImportManager,? extends java.lang.CharSequence> 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. |
|
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. |
|
protected java.lang.String |
nullSaveName(java.lang.String name)
|
|
void |
setBody(JvmExecutable executable,
Functions.Function1<ImportManager,? extends java.lang.CharSequence> 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 . |
|
void |
setDocumentation(JvmIdentifiableElement jvmElement,
java.lang.String documentation)
Attaches the given documentation to the given jvmElement. |
|
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 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 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 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 of the given annotation type's name and the given value. |
|
JvmAnnotationType |
toAnnotationType(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
Procedures.Procedure1<JvmAnnotationType> initializer)
Creates a public annotation declaration, associated to the given sourceElement. |
|
JvmGenericType |
toClass(org.eclipse.emf.ecore.EObject sourceElement,
QualifiedName name,
Procedures.Procedure1<JvmGenericType> initializer)
Creates a public class declaration, associated to the given sourceElement. |
|
JvmGenericType |
toClass(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
Procedures.Procedure1<JvmGenericType> initializer)
Creates a public class declaration, associated to the given sourceElement. |
|
JvmConstructor |
toConstructor(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String simpleName,
Procedures.Procedure1<JvmConstructor> init)
Creates and returns a constructor with the given simple name associated to the given source element. |
|
JvmEnumerationType |
toEnumerationType(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
Procedures.Procedure1<JvmEnumerationType> initializer)
Creates a public enum declaration, associated to the given sourceElement. |
|
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<JvmField> initializer)
|
|
JvmOperation |
toGetter(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
JvmTypeReference typeRef)
Creates a getter method for the given properties name with a simple implementation returning the value of a similarly named field. |
|
JvmGenericType |
toInterface(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
Procedures.Procedure1<JvmGenericType> initializer)
Creates a public interface declaration, associated to the given sourceElement. |
|
JvmOperation |
toMethod(org.eclipse.emf.ecore.EObject sourceElement,
java.lang.String name,
JvmTypeReference returnType,
Procedures.Procedure1<JvmOperation> init)
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)
Creates a setter method for the given properties name with the standard implementation assigning the passed parameter to a similarly named field. |
|
void |
translateAnnotationsTo(java.lang.Iterable<? extends XAnnotation> annotations,
JvmAnnotationTarget target)
translates XAnnotation s to JvmAnnotationReference s and adds them to the given
JvmAnnotationTarget |
|
protected org.eclipse.xtext.xbase.jvmmodel.JvmTypesBuilder.AnnotationValueTranslator |
translator(XExpression obj)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JvmTypesBuilder()
Method Detail |
---|
public void setBody(JvmExecutable logicalContainer, XExpression expr)
JvmExecutable
as the logical container for the given XExpression
.
This defines the context and sīthe scope for the given expression.
logicalContainer
- - the JvmExecutable
the expression is associated with. Must not be null
.expr
- - the expression. Can be null
in which case this function does nothing.public void setBody(JvmExecutable executable, Functions.Function1<ImportManager,? extends java.lang.CharSequence> 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.strategy
- - the compilation strategy. Must return zero or more Java statements.public java.lang.String getDocumentation(org.eclipse.emf.ecore.EObject source)
public void setDocumentation(JvmIdentifiableElement jvmElement, java.lang.String documentation)
public JvmGenericType toClass(org.eclipse.emf.ecore.EObject sourceElement, QualifiedName name, Procedures.Procedure1<JvmGenericType> initializer)
sourceElement
- - the sourceElement the resulting element is associated with.qualifiedName
- - the qualifiedName of the resulting class.initializer
- - the initializer to apply on the created class element
JvmGenericType
representing a Java class of the given name.public JvmGenericType toClass(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name, Procedures.Procedure1<JvmGenericType> initializer)
sourceElement
- - the sourceElement the resulting element is associated with.qualifiedName
- - the qualifiedName of the resulting class.initializer
- - the initializer to apply on the created class element
JvmGenericType
representing a Java class of the given name.public JvmGenericType toInterface(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name, Procedures.Procedure1<JvmGenericType> initializer)
sourceElement
- - the sourceElement the resulting element is associated with.qualifiedName
- - the qualifiedName of the resulting class.initializer
- - the initializer to apply on the created interface declaration.
JvmGenericType
representing a Java interface of the given name.public JvmAnnotationType toAnnotationType(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name, Procedures.Procedure1<JvmAnnotationType> initializer)
sourceElement
- - the sourceElement the resulting element is associated with.qualifiedName
- - the qualifiedName of the resulting class.initializer
- - the initializer to apply on the created annotation
JvmAnnotationType
representing a Java annatation of the given name.public JvmEnumerationType toEnumerationType(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name, Procedures.Procedure1<JvmEnumerationType> initializer)
sourceElement
- - the sourceElement the resulting element is associated with.qualifiedName
- - the qualifiedName of the resulting class.initializer
- - the initializer to apply on the created enumeration type
result
representing a Java class of the given name.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 class.typeRef
- - the type of the field
JvmField
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<JvmField> initializer)
protected java.lang.String nullSaveName(java.lang.String name)
public <T extends JvmIdentifiableElement> T associate(org.eclipse.emf.ecore.EObject sourceElement, T target)
IJvmModelAssociator
,
IJvmModelAssociations
public JvmOperation toMethod(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name, JvmTypeReference returnType, Procedures.Procedure1<JvmOperation> init)
public JvmOperation toGetter(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name, JvmTypeReference typeRef)
public String getFoo() {
return this.foo;
}
public JvmOperation toSetter(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name, JvmTypeReference typeRef)
public void setFoo(String foo) {
this.foo = foo;
}
public JvmFormalParameter toParameter(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String name, JvmTypeReference typeRef)
public JvmConstructor toConstructor(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String simpleName, Procedures.Procedure1<JvmConstructor> init)
public JvmAnnotationReference toAnnotation(org.eclipse.emf.ecore.EObject sourceElement, java.lang.Class<?> annotationType)
public JvmAnnotationReference toAnnotation(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String annotationTypeName)
public JvmAnnotationReference toAnnotation(org.eclipse.emf.ecore.EObject sourceElement, java.lang.Class<?> annotationType, java.lang.Object value)
sourceElement
- - the source element to associate the created element with.annotationType
- - the type of the created annotation.value
- - the value of the singlepublic JvmAnnotationReference toAnnotation(org.eclipse.emf.ecore.EObject sourceElement, java.lang.String annotationTypeName, 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 singlepublic JvmTypeReference cloneWithProxies(JvmTypeReference typeRef)
JvmTypeReference
without resolving any proxies.
public void initialization(JvmField field, Functions.Function1<ImportManager,? extends java.lang.CharSequence> 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.strategy
- - the compilation strategy. Must return just one valid Java expression.protected void addCompilationStrategy(JvmMember member, Functions.Function1<ImportManager,? extends java.lang.CharSequence> strategy)
public JvmTypeReference newTypeRef(org.eclipse.emf.ecore.EObject ctx, java.lang.Class<?> clazz, 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 arguments
JvmTypeReference
public JvmTypeReference newTypeRef(org.eclipse.emf.ecore.EObject ctx, java.lang.String typeName, 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 arguments
JvmTypeReference
public JvmTypeReference addArrayTypeDimension(JvmTypeReference componentType)
JvmTypeReference
is
already an array.public void translateAnnotationsTo(java.lang.Iterable<? extends XAnnotation> annotations, JvmAnnotationTarget target)
XAnnotation
s to JvmAnnotationReference
s and adds them to the given
JvmAnnotationTarget
protected JvmAnnotationReference getJvmAnnotationReference(XAnnotation anno)
protected JvmAnnotationValue getJvmAnnotationValue(XExpression value)
protected org.eclipse.xtext.xbase.jvmmodel.JvmTypesBuilder.AnnotationValueTranslator translator(XExpression obj)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |