protected void initialize ( SarlSkill source , JvmGenericType inferredJvmType ) { // Issue #356: do not generate if the skill has no name. assert source != null ; assert inferredJvmType != null ; if ( Strings . isNullOrEmpty ( source . getName ( ) ) ) { return ; } // Create the generation context that is used by the other transformation functions. final GenerationContext context = openContext ( source , inferredJvmType , Arrays . asList ( SarlField . class , SarlConstructor . class , SarlAction . class , SarlBehaviorUnit . class , SarlCapacityUses . class , SarlRequiredCapacity . class ) ) ; try { // Copy the documentation this . typeBuilder . copyDocumentationTo ( source , inferredJvmType ) ; // Change the modifiers on the generated type. setVisibility ( inferredJvmType , source ) ; inferredJvmType . setStatic ( false ) ; final boolean isAbstract = source . isAbstract ( ) || Utils . hasAbstractMember ( source ) ; inferredJvmType . setAbstract ( isAbstract ) ; inferredJvmType . setStrictFloatingPoint ( false ) ; inferredJvmType . setFinal ( ! isAbstract && source . isFinal ( ) ) ; // Generate the annotations. translateAnnotationsTo ( source . getAnnotations ( ) , inferredJvmType ) ; // Generate the extended types. appendConstrainedExtends ( context , inferredJvmType , Skill . class , SarlSkill . class , source . getExtends ( ) ) ; appendConstrainedImplements ( context , inferredJvmType , Capacity . class , SarlCapacity . class , source . getImplements ( ) ) ; // Issue #363: do not generate the skill if the SARL library is incompatible. if ( Utils . isCompatibleSARLLibraryOnClasspath ( this . typeReferences , source ) ) { // Generate the members of the generated type. appendAOPMembers ( inferredJvmType , source , context ) ; } // Add functions dedicated to comparisons (equals, hashCode, etc.) appendComparisonFunctions ( context , source , inferredJvmType ) ; // Add clone functions if the generated type is cloneable appendCloneFunctionIfCloneable ( context , source , inferredJvmType ) ; // Add the default constructors for the behavior, if not already added appendDefaultConstructors ( source , inferredJvmType ) ; // Add serialVersionUID field if the generated type is serializable appendSerialNumberIfSerializable ( context , source , inferredJvmType ) ; // Add the specification version of SARL appendSARLSpecificationVersion ( context , source , inferredJvmType ) ; // Add the type of SARL Element appendSARLElementType ( source , inferredJvmType ) ; // Resolving any name conflict with the generated JVM type this . nameClashResolver . resolveNameClashes ( inferredJvmType ) ; } finally { closeContext ( context ) ; } }
Initialize the SARL skill type .