io.sarl.lang.jvmmodel.fragments
Class AbstractJvmModelInferrerTypeFragment
All Known Subclasses:
AgentInferrerFragment, BehaviorInferrerFragment, CapacityInferrerFragment, EventInferrerFragment, SkillInferrerFragment, AnnotationTypeInferrerFragment, ClassInferrerFragment, EnumInferrerFragment, InterfaceInferrerFragment
abstract class AbstractJvmModelInferrerTypeFragment
extends AbstractJvmModelInferrerFragment
Abstract implementation of a fragment that may be used for inferring type to JVM model.
Maven Group Identifier:
io.sarl.lang
Maven Artifact Identifier:
compiler
Since:
0.15
Nested Type Summary
Modifier and type Type and description
protected class AbstractJvmModelInferrerTypeFragment.BehaviorUnitDefinitions
Informations about the behavior units and the guards.
protected record AbstractJvmModelInferrerTypeFragment.BehaviorUnitFunction
Functions about an event for the behavior units.
protected class AbstractJvmModelInferrerTypeFragment.BehaviorUnitFunctions
Functions about an event for the behavior units.
Field Summary
Modifier and type Field and description
protected var org.eclipse.xtext.xbase.validation.ReadAndWriteTracking readAndWriteTracking
The tracker of the read/write accesses to the fields.
Constructor Summary
Constructor and description
new
Action Summary
Modifier and type Action and description
protected void appendAOPMembers(IBaseJvmModelInferrer,JvmGenericType,XtendTypeDeclaration,GenerationContext)
Generate the code for the given SARL members in a agent-oriented container.
protected void appendCloneFunctionIfCloneable(IBaseJvmModelInferrer,GenerationContext,XtendTypeDeclaration,JvmGenericType)
Append the clone function only if the type is a subtype of Cloneable.
protected void appendComparisonFunctions(IBaseJvmModelInferrer,GenerationContext,XtendTypeDeclaration,JvmGenericType)
Create the functions that permits to compare the object.
protected void appendConstrainedExtends(IBaseJvmModelInferrer,GenerationContext,JvmGenericType,Class<T>,Class<T>,List<E>)
Generate the extended types for the given SARL statement.
protected void appendConstrainedExtends(IBaseJvmModelInferrer,GenerationContext,JvmGenericType,Class<T>,Class<T>,JvmParameterizedTypeReference)
Generate the extended types for the given SARL statement.
protected void appendConstrainedImplements(IBaseJvmModelInferrer,GenerationContext,JvmGenericType,Class<T>,Class<T>,List<E>)
Generate the implemented types for the given SARL statement.
protected void appendDefaultConstructors(IBaseJvmModelInferrer,XtendTypeDeclaration,JvmGenericType)
Add the default constructors.
protected void appendFunctionalInterfaceAnnotation(IBaseJvmModelInferrer,JvmGenericType)
Append the @FunctionalInterface to the given type if it is a functional interface according to the Java 8 specification definition.
protected void appendInjectableAnnotationIfInjectable(IBaseJvmModelInferrer,JvmDeclaredType,GenerationContext)
Append the injectable annotation to the given container.
protected void appendSARLElementType(IBaseJvmModelInferrer,XtendTypeDeclaration,JvmDeclaredType)
Append the SARL element type as an annotation to the given container.
protected void appendSARLSpecificationVersion(IBaseJvmModelInferrer,GenerationContext,XtendTypeDeclaration,JvmDeclaredType)
Append the SARL specification version as an annotation to the given container.
protected void appendSerialNumber(IBaseJvmModelInferrer,GenerationContext,XtendTypeDeclaration,JvmGenericType)
Append the serial number field.
protected void appendSerialNumberIfSerializable(IBaseJvmModelInferrer,GenerationContext,XtendTypeDeclaration,JvmGenericType)
Append the serial number field if and only if the container type is serializable.
protected void appendSyntheticDefaultValuedParameterMethods(IBaseJvmModelInferrer,XtendTypeDeclaration,JvmDeclaredType,boolean,GenerationContext)
Generate the missed operations that are the results from the generation of actions with default value parameters.
protected void appendXbaseGeneratedAnnotation(IBaseJvmModelInferrer,JvmAnnotationTarget)
Add the @XbaseGenerated annotation to the given target.
protected void copyNonStaticPublicJvmOperations(IBaseJvmModelInferrer,JvmGenericType,JvmGenericType,Set<E>,boolean,Procedure2<P1,P2>)
Copy the JVM operations from the source to the destination.
protected void copyTypeParametersFromJvmOperation(IBaseJvmModelInferrer,JvmOperation,JvmOperation)
Copy the type parameters from a JvmOperation.
protected java.lang.Iterable<T> getVisibleInheritedJvmConstructors(JvmGenericType,JvmGenericType)
Replies the constructors from the super type that are visible.
Field Details
readAndWriteTracking
protected var readAndWriteTracking : org.eclipse.xtext.xbase.validation.ReadAndWriteTracking
The tracker of the read/write accesses to the fields.
Since:
0.15
Constructor Details
new
new
Action Details
appendAOPMembers(IBaseJvmModelInferrer,JvmGenericType,XtendTypeDeclaration,GenerationContext)
protected def appendAOPMembers(IBaseJvmModelInferrer,JvmGenericType,XtendTypeDeclaration,GenerationContext)
Generate the code for the given SARL members in a agent-oriented container.
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
featureContainerType - the feature container.
container - the SARL container.
context - description of the generation context in which the members must be considered.
appendCloneFunctionIfCloneable(IBaseJvmModelInferrer,GenerationContext,XtendTypeDeclaration,JvmGenericType)
protected def appendCloneFunctionIfCloneable(IBaseJvmModelInferrer,GenerationContext,XtendTypeDeclaration,JvmGenericType)
Append the clone function only if the type is a subtype of Cloneable.

The clone function replies a value of the current type, not Object.
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
context - the current generation context.
source - the source object.
target - the inferred JVM object.
Since:
0.6
appendComparisonFunctions(IBaseJvmModelInferrer,GenerationContext,XtendTypeDeclaration,JvmGenericType)
protected def appendComparisonFunctions(IBaseJvmModelInferrer,GenerationContext,XtendTypeDeclaration,JvmGenericType)
Create the functions that permits to compare the object. The comparaison functions are equals(Object) and hashCode().
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
context - the current generation context.
source - the source object.
target - the inferred JVM object.
appendConstrainedExtends(IBaseJvmModelInferrer,GenerationContext,JvmGenericType,Class<T>,Class<T>,List<E>)
protected def appendConstrainedExtends(IBaseJvmModelInferrer,GenerationContext,JvmGenericType,Class<T>,Class<T>,List<E>)
Generate the extended types for the given SARL statement.
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
context - the context of the generation.
owner - the JVM element to change.
defaultJvmType - the default JVM type.
defaultSarlType - the default Sarl type.
supertypes - the supertypes.
appendConstrainedExtends(IBaseJvmModelInferrer,GenerationContext,JvmGenericType,Class<T>,Class<T>,JvmParameterizedTypeReference)
protected def appendConstrainedExtends(IBaseJvmModelInferrer,GenerationContext,JvmGenericType,Class<T>,Class<T>,JvmParameterizedTypeReference)
Generate the extended types for the given SARL statement.
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
context - the context of the generation.
owner - the JVM element to change.
defaultJvmType - the default JVM type.
defaultSarlType - the default SARL type.
supertype - the supertype.
appendConstrainedImplements(IBaseJvmModelInferrer,GenerationContext,JvmGenericType,Class<T>,Class<T>,List<E>)
protected def appendConstrainedImplements(IBaseJvmModelInferrer,GenerationContext,JvmGenericType,Class<T>,Class<T>,List<E>)
Generate the implemented types for the given SARL statement.
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
context - the context of the generation.
owner - the JVM element to change.
defaultJvmType - the default JVM type.
defaultSarlType - the default SARL type.
implementedtypes - the implemented types.
appendDefaultConstructors(IBaseJvmModelInferrer,XtendTypeDeclaration,JvmGenericType)
protected def appendDefaultConstructors(IBaseJvmModelInferrer,XtendTypeDeclaration,JvmGenericType)
Add the default constructors.

The default constructors have the same signature as the constructors of the super class.

This function adds the default constructors if no constructor was already added. This condition is determined with a call to hasConstructor().
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
source - the SARL element in which no constructor was specified. This SARL element should be associated to the target element.
target - the JVM type that is receiving the default constructor.
See:
hasConstructor
appendFunctionalInterfaceAnnotation(IBaseJvmModelInferrer,JvmGenericType)
protected def appendFunctionalInterfaceAnnotation(IBaseJvmModelInferrer,JvmGenericType)
Append the @FunctionalInterface to the given type if it is a functional interface according to the Java 8 specification definition.
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
type - the type to update.
appendInjectableAnnotationIfInjectable(IBaseJvmModelInferrer,JvmDeclaredType,GenerationContext)
protected def appendInjectableAnnotationIfInjectable(IBaseJvmModelInferrer,JvmDeclaredType,GenerationContext)
Append the injectable annotation to the given container.
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
target - the inferred JVM object.
context - the generation context.
Since:
0.12
appendSARLElementType(IBaseJvmModelInferrer,XtendTypeDeclaration,JvmDeclaredType)
protected def appendSARLElementType(IBaseJvmModelInferrer,XtendTypeDeclaration,JvmDeclaredType)
Append the SARL element type as an annotation to the given container.

The added annotation may be used by any underground platform for determining what is the type of the SARL element without invoking the costly "instanceof" operations.
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
source - the source object.
target - the inferred JVM object.
appendSARLSpecificationVersion(IBaseJvmModelInferrer,GenerationContext,XtendTypeDeclaration,JvmDeclaredType)
protected def appendSARLSpecificationVersion(IBaseJvmModelInferrer,GenerationContext,XtendTypeDeclaration,JvmDeclaredType)
Append the SARL specification version as an annotation to the given container.

The added annotation may be used by any underground platform for determining what is the version of the SARL specification that was used for generating the container.
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
context - the current generation context.
source - the source object.
target - the inferred JVM object.
appendSerialNumber(IBaseJvmModelInferrer,GenerationContext,XtendTypeDeclaration,JvmGenericType)
protected def appendSerialNumber(IBaseJvmModelInferrer,GenerationContext,XtendTypeDeclaration,JvmGenericType)
Append the serial number field.

The serial number field is computed from the given context and from the generated fields. The field is added if no field with name "serialVersionUID" was defined.

This function does not test if the field container is serializable.
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
context - the current generation context.
source - the source object.
target - the inferred JVM object.
See:
appendSerialNumberIfSerializable(IBaseJvmModelInferrer,GenerationContext,XtendTypeDeclaration,JvmGenericType)
appendSerialNumberIfSerializable(IBaseJvmModelInferrer,GenerationContext,XtendTypeDeclaration,JvmGenericType)
protected def appendSerialNumberIfSerializable(IBaseJvmModelInferrer,GenerationContext,XtendTypeDeclaration,JvmGenericType)
Append the serial number field if and only if the container type is serializable.

The serial number field is computed from the given context and from the generated fields.
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
context - the current generation context.
source - the source object.
target - the inferred JVM object.
See:
appendSerialNumber(IBaseJvmModelInferrer,GenerationContext,XtendTypeDeclaration,JvmGenericType)
appendSyntheticDefaultValuedParameterMethods(IBaseJvmModelInferrer,XtendTypeDeclaration,JvmDeclaredType,boolean,GenerationContext)
protected def appendSyntheticDefaultValuedParameterMethods(IBaseJvmModelInferrer,XtendTypeDeclaration,JvmDeclaredType,boolean,GenerationContext)
Generate the missed operations that are the results from the generation of actions with default value parameters.
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
source - the SARL container.
target - the JVM feature container.
ignoreOverridableOperations - indicates if the operations must not be added if they are marked has overridable.
context - description of the generation context in which the members must be considered.
appendXbaseGeneratedAnnotation(IBaseJvmModelInferrer,JvmAnnotationTarget)
protected def appendXbaseGeneratedAnnotation(IBaseJvmModelInferrer,JvmAnnotationTarget)
Add the @XbaseGenerated 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.
copyNonStaticPublicJvmOperations(IBaseJvmModelInferrer,JvmGenericType,JvmGenericType,Set<E>,boolean,Procedure2<P1,P2>)
protected def copyNonStaticPublicJvmOperations(IBaseJvmModelInferrer,JvmGenericType,JvmGenericType,Set<E>,boolean,Procedure2<P1,P2>)
Copy the JVM operations from the source to the destination.
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
source - the source.
target - the destination.
createdActions - the set of actions that are created before (input) or during (output) the invocation.
copyHiddenNames - indicates if the operations with hidden name are copied.
bodyBuilder - the builder of the target's operations.
Since:
0.12
copyTypeParametersFromJvmOperation(IBaseJvmModelInferrer,JvmOperation,JvmOperation)
protected def copyTypeParametersFromJvmOperation(IBaseJvmModelInferrer,JvmOperation,JvmOperation)
Copy the type parameters from a JvmOperation.

This function differs from copyAndFixTypeParameters(List, org.eclipse.xtext.common.types.JvmTypeParameterDeclarator) and copyTypeParameters(List, org.eclipse.xtext.common.types.JvmTypeParameterDeclarator) in the fact that the type parameters were already generated and fixed. The current function supper generic types by clone the types references with cloneWithTypeParametersAndProxies(JvmTypeReference, JvmExecutable, IBaseJvmModelInferrer).
Parameters:
baseInferrer - the inferrer that is the considered as the base (starting point) of inferring process.
fromOperation - the operation from which the type parameters are copied.
toOperation - the operation that will receives the new type parameters.
getVisibleInheritedJvmConstructors(JvmGenericType,JvmGenericType)
protected def getVisibleInheritedJvmConstructors(JvmGenericType,JvmGenericType) : java.lang.Iterable<T>
Replies the constructors from the super type that are visible.
Returns:
the visible inherited constructors.
Since:
0.15