io.sarl.lang.util
Class Utils
final class Utils
extends java.lang.Object
Utilities functions on JvmElements.
Maven Group Identifier:
io.sarl.lang
Maven Artifact Identifier:
compiler
Nested Type Summary
Modifier and type Type and description
enum Utils.SarlLibraryErrorCode
Error code for the getSARLLibraryVersionOnClasspath(TypeReferences, Notifier, OutParameter) function.
Action Summary
Modifier and type Action and description
static boolean canCast(LightweightTypeReference,LightweightTypeReference,boolean,boolean,boolean)
Replies if it is allowed to cast between the given types.
static org.eclipse.xtext.common.types.JvmTypeReference cloneWithTypeParametersAndProxies(JvmTypeReference,Iterable<T>,Map<K,V>,JvmTypeReferenceBuilder,JvmTypesBuilder,TypeReferences,TypesFactory)
Clone the given type reference that for being link to the given operation.
static int compareMajorMinorVersions(String,String)
Compare the two strings as they are version numbers with only major and minor components as beeing considered.
static int compareVersions(String,String)
Compare the two strings as they are version numbers.
Deprecated for removal since 0.13: see compareMajorMinorVersions(String, String)
static long computeSerialVersionUID(JvmGenericType)
Compute the serial version UID for the given JVM element.
static boolean containsGenericType(LightweightTypeReference)
Replies if a generic type parameter is declared into the given type.
static void copyTypeParametersFromJvmOperation(JvmOperation,JvmOperation,JvmTypeReferenceBuilder,JvmTypesBuilder,TypeReferences,TypesFactory)
Copy the type parameters from a JvmOperation.
static void copyTypeParametersFromJvmOperation(List<E>,List<E>,Map<K,V>,JvmTypeReferenceBuilder,JvmTypesBuilder,TypeReferences,TypesFactory)
Copy the type parameters from a JvmOperation.
static java.lang.String createNameForHiddenCapacityImplementationAttribute(String)
Create the name of the hidden field that is containing a capacity implementation.
static java.lang.String createNameForHiddenCapacityImplementationCallingMethodFromFieldName(String)
Create the name of the hidden method that is calling a capacity implementation.
static java.lang.String createNameForHiddenDefaultValueFunction(String)
Create the name of the hidden function that is containing a parameter's default value.
static java.lang.String createNameForHiddenEventHandlerMethod(String,int)
Create the name of the hidden method that is containing the event handler code.
static java.lang.String createNameForHiddenGuardEvaluatorMethod(String,int)
Create the name of the hidden method that is containing the event guard evaluation.
static java.lang.String createNameForHiddenGuardGeneralEvaluatorMethod(String)
Create the name of the hidden method that is containing the evaluation of all the guards for a given event.
static java.lang.String createNameForHiddenLocalVariable(String)
Create the name of the hidden local variable.
static java.lang.String dump(EObject)
Dump the object.
static java.lang.String dump(Object,boolean)
Dump the object.
static java.lang.String fixHiddenMember(String)
Replies a fixed version of the given name assuming that it is an hidden action, and reformating the reserved text.
static java.lang.String getActionSignatureString(SarlAction,ISerializer,SARLGrammarKeywordAccess,ImportManager)
This is a context-safe serializer of a signature.
static boolean getContainerNotOfType(EObject,Class<T>,OutParameter<T>,OutParameter<T>)
Returns the closest container object that is not of the requested type.
static boolean getContainerOfType(EObject,OutParameter<T>,OutParameter<T>,Class<T>*)
Returns the closest container object that is of one of the requested type.
static org.eclipse.emf.ecore.EObject getFirstContainerForPredicate(EObject,Function1<Param,Result>)
Returns the closest container object that is validating the predicate.
static org.eclipse.xtext.naming.QualifiedName getQualifiedName(JvmIdentifiableElement)
Replies the qualified name of the given element.
static org.eclipse.xtext.xbase.XAbstractFeatureCall getRootFeatureCall(XAbstractFeatureCall)
Replies the root feature call into a sequence of feature calls.
static org.eclipse.xtext.xbase.XAbstractFeatureCall getRootFeatureCall(XAbstractFeatureCall,XExpression,List<E>)
Replies the root feature call into a sequence of feature calls that has not reference to elements declared within the container, and that are not one of the container's parameters.
static java.lang.String getSarlCodeFor(EObject)
Replies the original code for the given Ecore object.
static java.lang.String getSARLLibraryVersionOnClasspath(TypeReferences,Notifier)
Replies the version of the SARL library on the classpath.
static SarlLibraryErrorCode getSARLLibraryVersionOnClasspath(TypeReferences,Notifier,OutParameter<T>)
Replies the version of the SARL library on the classpath.
static java.lang.String getStaticConstructorName
Replies the name given to the static constructors.
static void getSuperTypeParameterMap(JvmDeclaredType,Map<K,V>)
Extract the mapping between the type parameters declared within the super types and the type parameters arguments that are declared within the given type.
static boolean hasAbstractMember(XtendTypeDeclaration)
Replies if the given declaration has an abstract member.
static boolean isClass(Class<T>)
Replies if the given type is a class type.
static boolean isClass(LightweightTypeReference)
Replies if the given reference is pointing to a class type.
static boolean isCompatibleJDKVersionWhenInSARLProjectClasspath(String)
Check if a version of the JDK is compatible with the SARL libraries that is specified in the SARL project classpath.
static boolean isCompatibleJDKVersionWithSARLCompilationEnvironment
Check if a version of the JDK is compatible with the SARL compilation environment.
static boolean isCompatibleJDKVersionWithSARLCompilationEnvironment(String)
Check if a version of the JDK is compatible with the SARL compilation environment.
static boolean isCompatibleSARLLibraryOnClasspath(TypeReferences,Notifier)
Check if a compatible SARL library is available on the classpath.
static boolean isCompatibleSARLLibraryVersion(String)
Check if a version is compatible with the expected SARL library.
static boolean isCompatibleXtextVersion
Check if a version of the current Xtext is compatible with the SARL library.
static boolean isCompatibleXtextVersion(String)
Check if a version of Xtext is compatible with the SARL library.
static boolean isDynamicDefaultValueFunctionName(String)
Replies if the given name is the hidden name for a parameter's default value.
static boolean isFinal(Class<T>)
Replies if the given type is a final type.
static boolean isFinal(LightweightTypeReference)
Replies if the given reference is referencing a final type.
static boolean isFunctionalInterface(JvmGenericType,IActionPrototypeProvider)
Replies if the given type is a functional interface.
static boolean isImplicitLambdaParameterName(String)
Replies if the given name is related to an hidden parameter for closures.
static boolean isInterface(LightweightTypeReference)
Replies if the given type is an interface.
static boolean isNameForHiddenCapacityImplementationCallingMethod(String)
Replies if the given simple name is the name of the hidden method that is calling a capacity implementation.
static boolean isSARLAnnotation(Class<T>)
Replies if the given annotation is an annotation from the SARL core library.
static boolean isSARLAnnotation(String)
Replies if the given annotation is an annotation from the SARL core library.
static boolean isStaticConstructorName(String)
Replies if the given name is the hidden name for a static constructor.
static boolean isVarArg(List<E>)
Replies if the last parameter is a variadic parameter.
static boolean isVisible(JvmDeclaredType,JvmMember)
Replies if the target feature is visible from the type.
static void populateInheritanceContext(JvmDeclaredType,Map<K,V>,Map<K,V>,Map<K,V>,Map<K,V>,Map<K,V>,IActionPrototypeProvider)
Analyzing the type hierarchy of the given element, and extract any type-related information.
static void populateInheritanceContext(JvmDeclaredType,JvmTypeReference,Iterable<T>,Map<K,V>,Map<K,V>,Map<K,V>,Map<K,V>,Map<K,V>,IActionPrototypeProvider)
Analyzing the type hierarchy of the given element, and extract any type-related information.
static void populateInterfaceElements(JvmDeclaredType,Map<K,V>,Map<K,V>,IActionPrototypeProvider)
Analyzing the type hierarchy of the given interface and extract hierarchy information.
static void setStructuralFeature(EObject,EStructuralFeature,Object)
Set the given structure feature with the given value.
static java.util.List<E> singletonList(T)
Replies a singleton list with the given element, or the empty list if the element is null.
static org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference toLightweightTypeReference(JvmType,CommonTypeComputationServices)
Convert a type reference to a lightweight type reference.
static org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference toLightweightTypeReference(JvmTypeReference,CommonTypeComputationServices)
Convert a type reference to a lightweight type reference.
static org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference toLightweightTypeReference(JvmType,CommonTypeComputationServices,boolean)
Convert a type to a lightweight type reference.
static org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference toLightweightTypeReference(JvmTypeReference,CommonTypeComputationServices,boolean)
Convert a type reference to a lightweight type reference.
static org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference toLightweightTypeReference(JvmTypeReference,CommonTypeComputationServices,ResourceSet)
Convert a type reference to a lightweight type reference.
static org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference toLightweightTypeReference(JvmTypeReference,CommonTypeComputationServices,ResourceSet,boolean)
Convert a type reference to a lightweight type reference.
static java.lang.Object toReadableString(String)
Convert the given string of characters in order to be readable from a user's message.
Action Details
canCast(LightweightTypeReference,LightweightTypeReference,boolean,boolean,boolean)
def canCast(LightweightTypeReference,LightweightTypeReference,boolean,boolean,boolean) : boolean
Replies if it is allowed to cast between the given types.
Parameters:
fromType - - source type
toType - - target type
enablePrimitiveWidening - - indicates if the widening of the primitive types is allowed.
enableVoidMatchingNull - - indicates if the null is matching void.
allowSynonyms - - indicates if the synonyms are allowed.
Returns:
the state of the cast.
cloneWithTypeParametersAndProxies(JvmTypeReference,Iterable<T>,Map<K,V>,JvmTypeReferenceBuilder,JvmTypesBuilder,TypeReferences,TypesFactory)
def cloneWithTypeParametersAndProxies(JvmTypeReference,Iterable<T>,Map<K,V>,JvmTypeReferenceBuilder,JvmTypesBuilder,TypeReferences,TypesFactory) : org.eclipse.xtext.common.types.JvmTypeReference
Clone the given type reference that for being link to the given operation.

The proxies are not resolved, and the type parameters are clone when they are related to the type parameter of the type container.
Parameters:
type - the source type.
executableTypeParameters - the type parameters of the executable component that will contain the result type.
superTypeParameterMapping - the mapping from the type parameters inherited from the super types.
typeParameterBuilder - the builder if type parameter.
typeBuilder - the builder of type.
typeReferences - the builder of type references.
jvmTypesFactory - the factory of Jvm types.
Returns:
the result type, i.e. a copy of the source type.
Since:
0.6
compareMajorMinorVersions(String,String)
def compareMajorMinorVersions(String,String) : int
Compare the two strings as they are version numbers with only major and minor components as beeing considered.
Parameters:
v1 - - first version to compare.
v2 - - second version to compare.
Returns:
Negative integer of v1 is lower than v2 ; positive integer of v1 is greater than v2 ; 0 if they are strictly equal.
Since:
0.13
compareVersions(String,String)
def compareVersions(String,String) : int
Compare the two strings as they are version numbers.
Parameters:
v1 - - first version to compare.
v2 - - second version to compare.
Returns:
Negative integer of v1 is lower than v2 ; positive integer of v1 is greater than v2 ; 0 if they are strictly equal.
Deprecated:
see compareMajorMinorVersions(String, String)
computeSerialVersionUID(JvmGenericType)
def computeSerialVersionUID(JvmGenericType) : long
Compute the serial version UID for the given JVM element.
Parameters:
jvm - - the JVM element.
Returns:
the serial version UID.
See:
"http://docs.oracle.com/javase/8/docs/platform/serialization/spec/class.html#a4100"
containsGenericType(LightweightTypeReference)
def containsGenericType(LightweightTypeReference) : boolean
Replies if a generic type parameter is declared into the given type.
Parameters:
type - is the type to explore.
Returns:
code if the type contains a generic type.
copyTypeParametersFromJvmOperation(JvmOperation,JvmOperation,JvmTypeReferenceBuilder,JvmTypesBuilder,TypeReferences,TypesFactory)
def copyTypeParametersFromJvmOperation(JvmOperation,JvmOperation,JvmTypeReferenceBuilder,JvmTypesBuilder,TypeReferences,TypesFactory)
Copy the type parameters from a JvmOperation.

This function differs from XtendJvmModelInferrer.copyAndFixTypeParameters(List, JvmTypeParameterDeclarator) and XtendJvmModelInferrer.copyTypeParameters(List, 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, Iterable, Map, JvmTypeReferenceBuilder, JvmTypesBuilder, TypeReferences, TypesFactory).
Parameters:
fromOperation - the operation from which the type parameters are copied.
toOperation - the operation that will receives the new type parameters.
typeParameterBuilder - the builder if type parameter.
typeBuilder - the builder of type.
typeReferences - the builder of type references.
jvmTypesFactory - the factory of Jvm types.
Since:
0.6
copyTypeParametersFromJvmOperation(List<E>,List<E>,Map<K,V>,JvmTypeReferenceBuilder,JvmTypesBuilder,TypeReferences,TypesFactory)
def copyTypeParametersFromJvmOperation(List<E>,List<E>,Map<K,V>,JvmTypeReferenceBuilder,JvmTypesBuilder,TypeReferences,TypesFactory)
Copy the type parameters from a JvmOperation.

This function differs from XtendJvmModelInferrer.copyAndFixTypeParameters(List, JvmTypeParameterDeclarator) and XtendJvmModelInferrer.copyTypeParameters(List, 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, Iterable, Map, JvmTypeReferenceBuilder, JvmTypesBuilder, TypeReferences, TypesFactory).
Parameters:
inputParameters - the type parameters in the source operation.
outputParameters - the list of type parameters to be filled out.
superTypeParameterMapping - the mapping from the type parameters inherited from the super types.
typeParameterBuilder - the builder if type parameter.
typeBuilder - the builder of type.
typeReferences - the builder of type references.
jvmTypesFactory - the factory of Jvm types.
Since:
0.6
createNameForHiddenCapacityImplementationAttribute(String)
def createNameForHiddenCapacityImplementationAttribute(String) : java.lang.String
Create the name of the hidden field that is containing a capacity implementation.
Parameters:
id - the id of the capacity.
Returns:
the field name.
createNameForHiddenCapacityImplementationCallingMethodFromFieldName(String)
def createNameForHiddenCapacityImplementationCallingMethodFromFieldName(String) : java.lang.String
Create the name of the hidden method that is calling a capacity implementation.
Parameters:
capacityImplementationFieldName - the name of the extension field.
Returns:
the method name.
createNameForHiddenDefaultValueFunction(String)
def createNameForHiddenDefaultValueFunction(String) : java.lang.String
Create the name of the hidden function that is containing a parameter's default value.
Parameters:
id - the id of the default value.
Returns:
the method name.
Since:
0.12
createNameForHiddenEventHandlerMethod(String,int)
def createNameForHiddenEventHandlerMethod(String,int) : java.lang.String
Create the name of the hidden method that is containing the event handler code.
Parameters:
eventId - the id of the event.
handlerIndex - the index of the handler in the container type.
Returns:
the attribute name.
createNameForHiddenGuardEvaluatorMethod(String,int)
def createNameForHiddenGuardEvaluatorMethod(String,int) : java.lang.String
Create the name of the hidden method that is containing the event guard evaluation.
Parameters:
eventId - the id of the event.
handlerIndex - the index of the handler in the container type.
Returns:
the method name.
createNameForHiddenGuardGeneralEvaluatorMethod(String)
def createNameForHiddenGuardGeneralEvaluatorMethod(String) : java.lang.String
Create the name of the hidden method that is containing the evaluation of all the guards for a given event.
Parameters:
eventId - the id of the event.
Returns:
the method name.
createNameForHiddenLocalVariable(String)
def createNameForHiddenLocalVariable(String) : java.lang.String
Create the name of the hidden local variable.
Parameters:
id - the name of the local variable.
Returns:
the variable name.
dump(EObject)
def dump(EObject) : java.lang.String
Dump the object.
Parameters:
object - the object.
Returns:
the string representation of the object.
Since:
0.7
dump(Object,boolean)
def dump(Object,boolean) : java.lang.String
Dump the object.
Parameters:
object - the object.
includeStaticField - indicates if the static fields should be included.
Returns:
the string representation of the object.
Since:
0.6
fixHiddenMember(String)
def fixHiddenMember(String) : java.lang.String
Replies a fixed version of the given name assuming that it is an hidden action, and reformating the reserved text.

An hidden action is an action that is generated by the SARL compiler, and that cannot be defined by the SARL user.
Parameters:
name - - the name to fix.
Returns:
the fixed name.
getActionSignatureString(SarlAction,ISerializer,SARLGrammarKeywordAccess,ImportManager)
def getActionSignatureString(SarlAction,ISerializer,SARLGrammarKeywordAccess,ImportManager) : java.lang.String
This is a context-safe serializer of a signature.
Parameters:
signature - - the signature to serialize.
serializer - - the Xtext serializer
grammarAccess - - the accessor to the SARL grammar.
importManager - - used to collect the types to import. If null, the qualified names of the types with be put in the signature.
Returns:
the string representation of the signature.
getContainerNotOfType(EObject,Class<T>,OutParameter<T>,OutParameter<T>)
def getContainerNotOfType(EObject,Class<T>,OutParameter<T>,OutParameter<T>) : boolean
Returns the closest container object that is not of the requested type.
Parameters:
element - the element to start from.
type - the unexpected type.
container - the container.
directContainerChild - the child of the container that is or contains the given element.
Returns:
true if the container was found.
Since:
0.5
See:
getContainerOfType(EObject,Class<T>)
getContainerOfType(EObject,OutParameter<T>,OutParameter<T>,Class<T>*)
def getContainerOfType(EObject,OutParameter<T>,OutParameter<T>,Class<T>*) : boolean
Returns the closest container object that is of one of the requested type.
Parameters:
element - the element to start from.
container - the container.
directContainerChild - the child of the container that is or contains the given element.
types - the unexpected types.
Returns:
true if the container was found.
Since:
0.8
See:
getContainerOfType(EObject,Class<T>)
getFirstContainerForPredicate(EObject,Function1<Param,Result>)
def getFirstContainerForPredicate(EObject,Function1<Param,Result>) : org.eclipse.emf.ecore.EObject
Returns the closest container object that is validating the predicate.
Parameters:
element - the element to start from.
predicate - the predicate to test.
Returns:
the container or null .
Since:
0.5
See:
getContainerOfType(EObject,Class<T>)
getQualifiedName(JvmIdentifiableElement)
def getQualifiedName(JvmIdentifiableElement) : org.eclipse.xtext.naming.QualifiedName
Replies the qualified name of the given element.
Parameters:
element - the element.
Returns:
the qualified name of the element.
getRootFeatureCall(XAbstractFeatureCall)
def getRootFeatureCall(XAbstractFeatureCall) : org.eclipse.xtext.xbase.XAbstractFeatureCall
Replies the root feature call into a sequence of feature calls.
Parameters:
featureCall - the leaf feature call.
Returns:
the root feature call.
Since:
0.8.6
See:
getRootFeatureCall(XAbstractFeatureCall,XExpression,List<E>)
getRootFeatureCall(XAbstractFeatureCall,XExpression,List<E>)
def getRootFeatureCall(XAbstractFeatureCall,XExpression,List<E>) : org.eclipse.xtext.xbase.XAbstractFeatureCall
Replies the root feature call into a sequence of feature calls that has not reference to elements declared within the container, and that are not one of the container's parameters.
Parameters:
featureCall - the leaf feature call.
container - the container of the feature call.
containerParameters - the parameters of the container.
Returns:
the root feature call, or null if there is no root feature call.
Since:
0.8.6
See:
getRootFeatureCall(XAbstractFeatureCall)
getSarlCodeFor(EObject)
def getSarlCodeFor(EObject) : java.lang.String
Replies the original code for the given Ecore object.

The replied code is the SARL code within the source file. It's format depends on how the developer has input it.

This function does:
  • replace any sequence of "new line" characters by a space character, and
  • trim the whitespaces.
Parameters:
object - the object to search the code for.
Returns:
the SARL code for the given object, or null if no code was found.
Since:
0.7
getSARLLibraryVersionOnClasspath(TypeReferences,Notifier)
def getSARLLibraryVersionOnClasspath(TypeReferences,Notifier) : java.lang.String
Replies the version of the SARL library on the classpath.
Parameters:
typeReferences - - the accessor to the types.
context - - the context that is providing the access to the classpath.
Returns:
the version, or null if the SARL library cannot be found or is too old.
Deprecated:
see getSARLLibraryVersionOnClasspath(TypeReferences, Notifier, OutParameter)
getSARLLibraryVersionOnClasspath(TypeReferences,Notifier,OutParameter<T>)
def getSARLLibraryVersionOnClasspath(TypeReferences,Notifier,OutParameter<T>) : SarlLibraryErrorCode
Replies the version of the SARL library on the classpath.
Parameters:
typeReferences - - the accessor to the types.
context - the context that is providing the access to the classpath.
version - the version of the SARL library that was found, according to the returned error code.
Returns:
the version, or null if the SARL library cannot be found or is too old.
getStaticConstructorName
def getStaticConstructorName : java.lang.String
Replies the name given to the static constructors.
Returns:
the hidden name for static constructors.
Since:
0.12
getSuperTypeParameterMap(JvmDeclaredType,Map<K,V>)
def getSuperTypeParameterMap(JvmDeclaredType,Map<K,V>)
Extract the mapping between the type parameters declared within the super types and the type parameters arguments that are declared within the given type.

For example, consider the following code:
br interface X&lt;T&gt; {br   def a(p1 : T, p2 : U) with Ubr }br interface Y&lt;T&gt; {br }br class Z&lt;TT&gt; implements X&lt;TT&gt;, Y&lt;TT&gt; {br   def a(p1 : TT, p2 : W) with W { }br }br 
The mapping is:
br X.T =&gt; TTbr Y.T =&gt; TTbr 
Parameters:
type - the type to analyze.
mapping - the map to fill with the mapping.
Since:
0.7
hasAbstractMember(XtendTypeDeclaration)
def hasAbstractMember(XtendTypeDeclaration) : boolean
Replies if the given declaration has an abstract member.
Parameters:
declaration - - the declaration.
Returns:
true if the given type has an abstract function.
isClass(Class<T>)
def isClass(Class<T>) : boolean
Replies if the given type is a class type.
Parameters:
type - - the type to test.
Returns:
true if the element is a class type.
isClass(LightweightTypeReference)
def isClass(LightweightTypeReference) : boolean
Replies if the given reference is pointing to a class type.
Parameters:
typeRef - - the type reference to test.
Returns:
true if the pointed element is a class type.
isCompatibleJDKVersionWhenInSARLProjectClasspath(String)
def isCompatibleJDKVersionWhenInSARLProjectClasspath(String) : boolean
Check if a version of the JDK is compatible with the SARL libraries that is specified in the SARL project classpath. In other words, check if the SARL libraries in compiled SARL project are compatible with the JDK at the given version.
Parameters:
version - - the version to test.
Returns:
true if this version is for a compatible JDK. Otherwise false .
Since:
0.10
See:
MINIMAL_JDK_VERSION_IN_SARL_PROJECT_CLASSPATH , INCOMPATIBLE_JDK_VERSION_IN_SARL_PROJECT_CLASSPATH
isCompatibleJDKVersionWithSARLCompilationEnvironment
def isCompatibleJDKVersionWithSARLCompilationEnvironment : boolean
Check if a version of the JDK is compatible with the SARL compilation environment. In other words, check if the SARL compiler is able to be run without issue with the current JDK.
Returns:
true if this version is for a compatible JDK. Otherwise false .
Since:
0.10
See:
MINIMAL_JDK_VERSION_FOR_SARL_COMPILATION_ENVIRONMENT , INCOMPATIBLE_JDK_VERSION_FOR_SARL_COMPILATION_ENVIRONMENT
isCompatibleJDKVersionWithSARLCompilationEnvironment(String)
def isCompatibleJDKVersionWithSARLCompilationEnvironment(String) : boolean
Check if a version of the JDK is compatible with the SARL compilation environment. In other words, check if the SARL compiler is able to be run without issue with a JDK at the given version.
Parameters:
version - - the version to test.
Returns:
true if this version is for a compatible JDK. Otherwise false .
Since:
0.10
See:
MINIMAL_JDK_VERSION_FOR_SARL_COMPILATION_ENVIRONMENT , INCOMPATIBLE_JDK_VERSION_FOR_SARL_COMPILATION_ENVIRONMENT
isCompatibleSARLLibraryOnClasspath(TypeReferences,Notifier)
def isCompatibleSARLLibraryOnClasspath(TypeReferences,Notifier) : boolean
Check if a compatible SARL library is available on the classpath.
Parameters:
typeReferences - - the accessor to the types.
context - - the context that is providing the access to the classpath.
Returns:
true if a compatible SARL library was found. Otherwise false .
isCompatibleSARLLibraryVersion(String)
def isCompatibleSARLLibraryVersion(String) : boolean
Check if a version is compatible with the expected SARL library.
Parameters:
version - - the version to test.
Returns:
true if a compatible SARL library was found. Otherwise false .
isCompatibleXtextVersion
def isCompatibleXtextVersion : boolean
Check if a version of the current Xtext is compatible with the SARL library.
Returns:
true if this version is for a compatible Xtext. Otherwise false .
isCompatibleXtextVersion(String)
def isCompatibleXtextVersion(String) : boolean
Check if a version of Xtext is compatible with the SARL library.
Parameters:
version - - the version to test.
Returns:
true if this version is for a compatible Xtext. Otherwise false .
isDynamicDefaultValueFunctionName(String)
def isDynamicDefaultValueFunctionName(String) : boolean
Replies if the given name is the hidden name for a parameter's default value.
Parameters:
name - the name to test.
Returns:
true if the given name is the one for a default value.
Since:
0.12
isFinal(Class<T>)
def isFinal(Class<T>) : boolean
Replies if the given type is a final type.
Parameters:
expressionType - - the type to test.
Returns:
true if the given type is final.
isFinal(LightweightTypeReference)
def isFinal(LightweightTypeReference) : boolean
Replies if the given reference is referencing a final type.
Parameters:
expressionTypeRef - - the type reference to test.
Returns:
true if the given type is final.
isFunctionalInterface(JvmGenericType,IActionPrototypeProvider)
def isFunctionalInterface(JvmGenericType,IActionPrototypeProvider) : boolean
Replies if the given type is a functional interface.

This function does not test if the @FunctionalInterface is attached to the type. The function counts the number of operations.
Parameters:
type - the type to test.
sarlSignatureProvider - the provider of SARL operation signatures.
Returns:
true if the given type is final.
isImplicitLambdaParameterName(String)
def isImplicitLambdaParameterName(String) : boolean
Replies if the given name is related to an hidden parameter for closures.

An hidden parameter for closures is the name assigned to a formal parameter for a closure when no name is explicitly provided.
Parameters:
name - - the name to test.
Returns:
true if the given name is reserved by SARL.
isInterface(LightweightTypeReference)
def isInterface(LightweightTypeReference) : boolean
Replies if the given type is an interface.
Parameters:
type - - the type to test.
Returns:
true if the given type is an interface.
isNameForHiddenCapacityImplementationCallingMethod(String)
def isNameForHiddenCapacityImplementationCallingMethod(String) : boolean
Replies if the given simple name is the name of the hidden method that is calling a capacity implementation.
Parameters:
simpleName - the simple name.
Returns:
true if the given simple name if for the hidden method for capacuty uses.
isSARLAnnotation(Class<T>)
def isSARLAnnotation(Class<T>) : boolean
Replies if the given annotation is an annotation from the SARL core library.
Parameters:
type - the type of the annotation
Returns:
true if the given type is a SARL annotation.
isSARLAnnotation(String)
def isSARLAnnotation(String) : boolean
Replies if the given annotation is an annotation from the SARL core library.
Parameters:
qualifiedName - the qualified name of the annotation type.
Returns:
true if the given type is a SARL annotation.
isStaticConstructorName(String)
def isStaticConstructorName(String) : boolean
Replies if the given name is the hidden name for a static constructor.
Parameters:
name - the name to test.
Returns:
true if the given name is the one for a static constructor.
Since:
0.12
isVarArg(List<E>)
def isVarArg(List<E>) : boolean
Replies if the last parameter is a variadic parameter.
Parameters:
params - - parameters.
Returns:
true if the late parameter is variadic.
isVisible(JvmDeclaredType,JvmMember)
def isVisible(JvmDeclaredType,JvmMember) : boolean
Replies if the target feature is visible from the type.
Parameters:
fromType - - the type from which the feature visibility is tested.
target - - the feature to test for the visibility.
Returns:
true if the given type can see the target feature.
populateInheritanceContext(JvmDeclaredType,Map<K,V>,Map<K,V>,Map<K,V>,Map<K,V>,Map<K,V>,IActionPrototypeProvider)
def populateInheritanceContext(JvmDeclaredType,Map<K,V>,Map<K,V>,Map<K,V>,Map<K,V>,Map<K,V>,IActionPrototypeProvider)
Analyzing the type hierarchy of the given element, and extract any type-related information.
Parameters:
jvmElement - - the element to analyze
finalOperations - - filled with the final operations inherited by the element.
overridableOperations - - filled with the oervrideable operations inherited by the element.
inheritedFields - - filled with the fields inherited by the element.
operationsToImplement - - filled with the abstract operations inherited by the element.
superConstructors - - filled with the construstors of the super type.
sarlSignatureProvider - - provider of tools related to action signatures.
See:
org.eclipse.xtext.xbase.typesystem.override.OverrideHelper
populateInheritanceContext(JvmDeclaredType,JvmTypeReference,Iterable<T>,Map<K,V>,Map<K,V>,Map<K,V>,Map<K,V>,Map<K,V>,IActionPrototypeProvider)
def populateInheritanceContext(JvmDeclaredType,JvmTypeReference,Iterable<T>,Map<K,V>,Map<K,V>,Map<K,V>,Map<K,V>,Map<K,V>,IActionPrototypeProvider)
Analyzing the type hierarchy of the given element, and extract any type-related information.
Parameters:
jvmElement - - the element to analyze
extendedClass - the extended class.
extendedInterfaces - the extended interfaces.
finalOperations - - filled with the final operations inherited by the element.
overridableOperations - - filled with the oervrideable operations inherited by the element.
inheritedFields - - filled with the fields inherited by the element.
operationsToImplement - - filled with the abstract operations inherited by the element.
superConstructors - - filled with the construstors of the super type.
sarlSignatureProvider - - provider of tools related to action signatures.
See:
org.eclipse.xtext.xbase.typesystem.override.OverrideHelper
populateInterfaceElements(JvmDeclaredType,Map<K,V>,Map<K,V>,IActionPrototypeProvider)
def populateInterfaceElements(JvmDeclaredType,Map<K,V>,Map<K,V>,IActionPrototypeProvider)
Analyzing the type hierarchy of the given interface and extract hierarchy information.
Parameters:
jvmElement - - the element to analyze
operations - - filled with the operations inside and inherited by the element.
fields - - filled with the fields inside and inherited by the element.
sarlSignatureProvider - - provider of tools related to action signatures.
See:
org.eclipse.xtext.xbase.typesystem.override.OverrideHelper
setStructuralFeature(EObject,EStructuralFeature,Object)
def setStructuralFeature(EObject,EStructuralFeature,Object)
Set the given structure feature with the given value.
Parameters:
object - the object that contains the feature.
property - the feature to change.
value - the value of the feature.
singletonList(T)
def singletonList(T) : java.util.List<E>

with T

Replies a singleton list with the given element, or the empty list if the element is null.
Parameters:
<T> - the type of the element in the list.
element - the element.
Returns:
the list with the element, or the empty list.
toLightweightTypeReference(JvmType,CommonTypeComputationServices)
def toLightweightTypeReference(JvmType,CommonTypeComputationServices) : org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference
Convert a type reference to a lightweight type reference.
Parameters:
type - - type to convert.
services - - services used for the conversion
Returns:
the lightweight type reference.
toLightweightTypeReference(JvmTypeReference,CommonTypeComputationServices)
def toLightweightTypeReference(JvmTypeReference,CommonTypeComputationServices) : org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference
Convert a type reference to a lightweight type reference.
Parameters:
typeRef - - reference to convert.
services - - services used for the conversion
Returns:
the lightweight type reference.
toLightweightTypeReference(JvmType,CommonTypeComputationServices,boolean)
def toLightweightTypeReference(JvmType,CommonTypeComputationServices,boolean) : org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference
Convert a type to a lightweight type reference.
Parameters:
type - - type to convert.
services - - services used for the conversion
keepUnboundWildcardInformation - - indicates if the unbound wild card information must be keeped in the lightweight reference.
Returns:
the lightweight type reference.
toLightweightTypeReference(JvmTypeReference,CommonTypeComputationServices,boolean)
def toLightweightTypeReference(JvmTypeReference,CommonTypeComputationServices,boolean) : org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference
Convert a type reference to a lightweight type reference.
Parameters:
typeRef - - reference to convert.
services - - services used for the conversion
keepUnboundWildcardInformation - - indicates if the unbound wild card information must be keeped in the lightweight reference.
Returns:
the lightweight type reference.
toLightweightTypeReference(JvmTypeReference,CommonTypeComputationServices,ResourceSet)
def toLightweightTypeReference(JvmTypeReference,CommonTypeComputationServices,ResourceSet) : org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference
Convert a type reference to a lightweight type reference.
Parameters:
typeRef - - reference to convert.
services - - services used for the conversion
context - the context of the reference.
Returns:
the lightweight type reference.
Since:
0.12
toLightweightTypeReference(JvmTypeReference,CommonTypeComputationServices,ResourceSet,boolean)
def toLightweightTypeReference(JvmTypeReference,CommonTypeComputationServices,ResourceSet,boolean) : org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference
Convert a type reference to a lightweight type reference.
Parameters:
typeRef - - reference to convert.
services - - services used for the conversion
context - the context of the reference.
keepUnboundWildcardInformation - - indicates if the unbound wild card information must be keeped in the lightweight reference.
Returns:
the lightweight type reference.
Since:
0.12
toReadableString(String)
def toReadableString(String) : java.lang.Object
Convert the given string of characters in order to be readable from a user's message.
Parameters:
text - the text to convert.
Returns:
the readable text.
Since:
0.12