io.sarl.lang.jvmmodel.fragments
Class AbstractJvmModelInferrerFragment
All Known Subclasses:
AbstractJvmModelInferrerExecutableFragment, Impl, AbstractJvmModelInferrerTypeFragment, ArtifactInferrerFragment, BehaviorUnitInferrerFragment, CapacityUseInferrerFragment, RequireCapacityInferrerFragment, SpaceInferrerFragment, FieldInferrerFragment
abstract class AbstractJvmModelInferrerFragment
extends java.lang.Object
Abstract implementation of a fragment that may be used for inferring the JVM model.
Maven Group Identifier:
io.sarl.lang
Maven Artifact Identifier:
compiler
Since:
0.15
Nested Type Summary
Modifier and type Type and description
class AbstractJvmModelInferrerFragment.Impl
Abstract implementation of a fragment that may be used for inferring the JVM model.
Field Summary
Modifier and type Field and description
protected var SARLAnnotationUtil annotationUtils
Utilities for JVM annotations.
protected var org.eclipse.xtext.xbase.jvmmodel.IJvmModelAssociator associator
Associator of the SARL element to the generated JVM element.
protected var ITypeDefaultValueProvider defaultValueProvider
Provider the default value for a specific type.
protected static val java.lang.String GENERATED_NAME
Name of the annotation used for marking the constructs as generated.
protected var SARLGrammarKeywordAccess grammarKeywordAccess
Accessor to the SARL keywords defined in the grammar.
protected var org.eclipse.xtext.common.types.util.AnnotationLookup jvmAnnotationFinder
Finder of JVM annotations attached to JVM elements.
protected var org.eclipse.xtext.xbase.jvmmodel.JvmTypesBuilder jvmTypeBuilder
Tools for adding constructs to the JVM elements.
protected var org.eclipse.xtext.common.types.util.TypeReferences jvmTypeReferences
Builder of and accessor to JVM type references.
protected var org.eclipse.xtext.common.types.TypesFactory jvmTypesFactory
Factory of JVM types.
protected var org.eclipse.xtend.core.jvmmodel.SyntheticNameClashResolver nameClashResolver
Resolver on name incompatibility.
protected static val java.lang.String RUNNABLE_COLLECTION
Name for the collection of runnable objects for the behavior units.
protected var SarlJvmModelAssociations sarlAssociations
Access to the associations between SARL objects and JVM objects.
protected var IActionPrototypeProvider sarlSignatureProvider
Manager and provider of SARL action signatures.
protected var org.eclipse.xtext.xbase.typesystem.util.CommonTypeComputationServices services
Several generation services.
Constructor Summary
Constructor and description
new
Action Summary
Modifier and type Action and description
protected org.eclipse.xtext.common.types.JvmAnnotationReference addAnnotationSafe(JvmAnnotationTarget,Class<T>,int)
Add annotation safely.
protected org.eclipse.xtext.common.types.JvmAnnotationReference addAnnotationSafe(IBaseJvmModelInferrer,JvmAnnotationTarget,Class<T>,String*)
Add annotation safely.
protected org.eclipse.xtext.common.types.JvmAnnotationReference addAnnotationSafe(IBaseJvmModelInferrer,JvmAnnotationTarget,String,String*)
Add annotation safely.
protected org.eclipse.xtext.common.types.JvmAnnotationReference annotationClassRef(IBaseJvmModelInferrer,Class<T>,List<E>)
Create a JVM annotation with classes as values.
protected final void appendGeneratedAnnotation(IBaseJvmModelInferrer,JvmAnnotationTarget,GenerationContext)
Add the @Generated annotation to the given target.
protected void appendGeneratedAnnotation(IBaseJvmModelInferrer,JvmAnnotationTarget,GenerationContext,String)
Add the @Generated annotation to the given target.
protected org.eclipse.xtext.common.types.JvmTypeReference cloneWithProxiesFromOtherResource(JvmTypeReference,JvmExecutable,IBaseJvmModelInferrer)
Clone the given type reference that is associated to another Xtext resource.
protected org.eclipse.xtext.common.types.JvmTypeReference cloneWithTypeParametersAndProxies(JvmTypeReference,JvmExecutable,IBaseJvmModelInferrer)
Clone the given type reference that for being link to the given executable component.
protected boolean copyAndCleanDocumentationTo(XtendExecutable,JvmExecutable)
Copy and clean the given documentation by removing any unecessary @param.
protected boolean copyAndCleanDocumentationTo(JvmExecutable,JvmExecutable)
Copy and clean the given documentation by removing any unnecessary @param.
void inferLocalClass(IBaseJvmModelInferrer,AnonymousClass,String,JvmFeature)
Infer and transform the local (anonymous) class.
protected void initializeLocalTypes(IBaseJvmModelInferrer,GenerationContext,JvmFeature,XExpression)
Initialize the local class to the given expression.
protected void setBody(JvmExecutable,StringConcatenationClient)
Set the body of the executable.
protected void setBody(JvmExecutable,Procedure1<Param>)
Set the body of the executable.
void setBody(IBaseJvmModelInferrer,JvmExecutable,XExpression)
Set the body of the executable.
protected void setVisibility(JvmMember,XtendMember)
Change the visibility modifier of the given member.
protected org.eclipse.xtext.common.types.JvmTypeReference skipTypeParameters(JvmTypeReference,Notifier)
Remove the type parameters from the given type.
protected static org.eclipse.xtend2.lib.StringConcatenationClient toStringConcatenation(String*)
Create a string concatenation client from a set of Java code lines.
protected void translateAnnotationsTo(List<E>,JvmAnnotationTarget,Class<T>*)
Copy the annotations, except the ones given as parameters.
Field Details
annotationUtils
protected var annotationUtils : SARLAnnotationUtil
Utilities for JVM annotations.
associator
protected var associator : org.eclipse.xtext.xbase.jvmmodel.IJvmModelAssociator
Associator of the SARL element to the generated JVM element.
defaultValueProvider
protected var defaultValueProvider : ITypeDefaultValueProvider
Provider the default value for a specific type.
GENERATED_NAME
protected static val GENERATED_NAME : java.lang.String
Name of the annotation used for marking the constructs as generated.
grammarKeywordAccess
protected var grammarKeywordAccess : SARLGrammarKeywordAccess
Accessor to the SARL keywords defined in the grammar.
jvmAnnotationFinder
protected var jvmAnnotationFinder : org.eclipse.xtext.common.types.util.AnnotationLookup
Finder of JVM annotations attached to JVM elements.
jvmTypeBuilder
protected var jvmTypeBuilder : org.eclipse.xtext.xbase.jvmmodel.JvmTypesBuilder
Tools for adding constructs to the JVM elements.
See:
jvmTypesFactory
jvmTypeReferences
protected var jvmTypeReferences : org.eclipse.xtext.common.types.util.TypeReferences
Builder of and accessor to JVM type references.
jvmTypesFactory
protected var jvmTypesFactory : org.eclipse.xtext.common.types.TypesFactory
Factory of JVM types.
See:
jvmTypeBuilder
nameClashResolver
protected var nameClashResolver : org.eclipse.xtend.core.jvmmodel.SyntheticNameClashResolver
Resolver on name incompatibility.
RUNNABLE_COLLECTION
protected static val RUNNABLE_COLLECTION : java.lang.String
Name for the collection of runnable objects for the behavior units.
sarlAssociations
protected var sarlAssociations : SarlJvmModelAssociations
Access to the associations between SARL objects and JVM objects.
sarlSignatureProvider
protected var sarlSignatureProvider : IActionPrototypeProvider
Manager and provider of SARL action signatures.
services
protected var services : org.eclipse.xtext.xbase.typesystem.util.CommonTypeComputationServices
Several generation services.
Constructor Details
new
new
Action Details
addAnnotationSafe(JvmAnnotationTarget,Class<T>,int)
protected def addAnnotationSafe(JvmAnnotationTarget,Class<T>,int) : org.eclipse.xtext.common.types.JvmAnnotationReference
Add annotation safely.

This function creates an annotation reference. If the type for the annotation is not found; no annotation is added.
Parameters:
target - the receiver of the annotation.
annotationType - the type of the annotation.
value - the annotations value.
Returns:
the annotation reference or null if the annotation cannot be added.
addAnnotationSafe(IBaseJvmModelInferrer,JvmAnnotationTarget,Class<T>,String*)
protected def addAnnotationSafe(IBaseJvmModelInferrer,JvmAnnotationTarget,Class<T>,String*) : org.eclipse.xtext.common.types.JvmAnnotationReference
Add annotation safely.

This function creates an annotation reference. If the type for the annotation is not found; no annotation is added.
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
target - the receiver of the annotation.
annotationType - the type of the annotation.
values - the annotations values.
Returns:
the annotation reference or null if the annotation cannot be added.
addAnnotationSafe(IBaseJvmModelInferrer,JvmAnnotationTarget,String,String*)
protected def addAnnotationSafe(IBaseJvmModelInferrer,JvmAnnotationTarget,String,String*) : org.eclipse.xtext.common.types.JvmAnnotationReference
Add annotation safely.

This function creates an annotation reference. If the type for the annotation is not found; no annotation is added.
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
target - the receiver of the annotation.
annotationType - the type of the annotation.
values - the annotations values.
Returns:
the annotation reference or null if the annotation cannot be added.
Since:
0.12
annotationClassRef(IBaseJvmModelInferrer,Class<T>,List<E>)
protected def annotationClassRef(IBaseJvmModelInferrer,Class<T>,List<E>) : org.eclipse.xtext.common.types.JvmAnnotationReference
Create a JVM annotation with classes as values.
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
type - the type of the annotation.
values - the values.
Returns:
the reference to the JVM annotation.
appendGeneratedAnnotation(IBaseJvmModelInferrer,JvmAnnotationTarget,GenerationContext)
protected def appendGeneratedAnnotation(IBaseJvmModelInferrer,JvmAnnotationTarget,GenerationContext)
Add the @Generated annotation to the given target. The annotation will not have any generated SARL code associated to it.
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
target - the target of the annotation.
context - the generation context.
appendGeneratedAnnotation(IBaseJvmModelInferrer,JvmAnnotationTarget,GenerationContext,String)
protected def appendGeneratedAnnotation(IBaseJvmModelInferrer,JvmAnnotationTarget,GenerationContext,String)
Add the @Generated annotation to the given target.
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
target - the target of the annotation.
context - the generation context.
sarlCode - the code that is the cause of the generation.
cloneWithProxiesFromOtherResource(JvmTypeReference,JvmExecutable,IBaseJvmModelInferrer)
protected def cloneWithProxiesFromOtherResource(JvmTypeReference,JvmExecutable,IBaseJvmModelInferrer) : org.eclipse.xtext.common.types.JvmTypeReference
Clone the given type reference that is associated to another Xtext resource.

This function ensures that the resource of the reference clone is not pointing to the resource of the original reference.

This function calls cloneWithProxies(JvmTypeReference) or cloneWithTypeParametersAndProxies(JvmTypeReference, JvmExecutable, IBaseJvmModelInferrer) if the target is null for the first, and not null for the second.
Parameters:
type - the source type.
target - the operation for which the type is clone, or null if not relevant.
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
Returns:
the result type, i.e. a copy of the source type.
cloneWithTypeParametersAndProxies(JvmTypeReference,JvmExecutable,IBaseJvmModelInferrer)
protected def cloneWithTypeParametersAndProxies(JvmTypeReference,JvmExecutable,IBaseJvmModelInferrer) : org.eclipse.xtext.common.types.JvmTypeReference
Clone the given type reference that for being link to the given executable component.

The proxies are not resolved, and the type parameters are clone when they are related to the type parameter of the executable or the type container.
Parameters:
type - the source type.
forExecutable - the executable component that will contain the result type.
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
Returns:
the result type, i.e. a copy of the source type.
copyAndCleanDocumentationTo(XtendExecutable,JvmExecutable)
protected def copyAndCleanDocumentationTo(XtendExecutable,JvmExecutable) : boolean
Copy and clean the given documentation by removing any unecessary @param.
Parameters:
sourceOperation - the source for the documentation.
targetOperation - the target for the documentation.
Returns:
true if a documentation was added.
copyAndCleanDocumentationTo(JvmExecutable,JvmExecutable)
protected def copyAndCleanDocumentationTo(JvmExecutable,JvmExecutable) : boolean
Copy and clean the given documentation by removing any unnecessary @param.
Parameters:
sourceOperation - the source for the documentation.
targetOperation - the target for the documentation.
Returns:
true if a documentation was added.
inferLocalClass(IBaseJvmModelInferrer,AnonymousClass,String,JvmFeature)
def inferLocalClass(IBaseJvmModelInferrer,AnonymousClass,String,JvmFeature)
Infer and transform the local (anonymous) class.
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
anonymousClass - the anonymous class to be inferred.
localClassName - the name of the class.
container - the container feature of the anonymous class.
initializeLocalTypes(IBaseJvmModelInferrer,GenerationContext,JvmFeature,XExpression)
protected def initializeLocalTypes(IBaseJvmModelInferrer,GenerationContext,JvmFeature,XExpression)
Initialize the local class to the given expression.
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
context - the generation context.
feature - the feature which contains the expression.
expression - the expression which contains the local class.
setBody(JvmExecutable,StringConcatenationClient)
protected def setBody(JvmExecutable,StringConcatenationClient)
Set the body of the executable.
Parameters:
executable - the executable.
expression - the body definition.
setBody(JvmExecutable,Procedure1<Param>)
protected def setBody(JvmExecutable,Procedure1<Param>)
Set the body of the executable.
Parameters:
executable - the executable.
expression - the body definition.
setBody(IBaseJvmModelInferrer,JvmExecutable,XExpression)
def setBody(IBaseJvmModelInferrer,JvmExecutable,XExpression)
Set the body of the executable.

Overridden from Xtend for: removing the existing associated body, and delaying the local type inference.
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
executable - the executable to set the body to.
expression - the expression that is representing the body of the executable.
setVisibility(JvmMember,XtendMember)
protected def setVisibility(JvmMember,XtendMember)
Change the visibility modifier of the given member.
Parameters:
jvmMember - the JVM version of the member.
member - the SARL version of the member
skipTypeParameters(JvmTypeReference,Notifier)
protected def skipTypeParameters(JvmTypeReference,Notifier) : org.eclipse.xtext.common.types.JvmTypeReference
Remove the type parameters from the given type.
Criteria for removal
Referenced type Input Replied referenced type Output
Type with generic type parameter T<G> the type itself T
Type without generic type parameter T the type itself T
Type parameter without bound <S> Object Object
Type parameter with lower bound <S super B> Object Object
Type parameter with upper bound <S extends B> the bound type B
Parameters:
type - the type.
context - the context in which the reference is located.
Returns:
the same type without the type parameters.
toStringConcatenation(String*)
protected def toStringConcatenation(String*) : org.eclipse.xtend2.lib.StringConcatenationClient
Create a string concatenation client from a set of Java code lines.
Parameters:
javaCodeLines - the Java code lines.
Returns:
the client.
translateAnnotationsTo(List<E>,JvmAnnotationTarget,Class<T>*)
protected def translateAnnotationsTo(List<E>,JvmAnnotationTarget,Class<T>*)
Copy the annotations, except the ones given as parameters.
Parameters:
annotations - the annotations to copy.
target - the target.
exceptions - the annotations to skip.