templates.ContainedElementsMethod.vm Maven / Gradle / Ivy
#* @vtlvariable name="currentClass" type="org.eclipse.emf.ecore.EClass" *#
#* @vtlvariable name="FQNHelper" type="org.kevoree.modeling.kotlin.generator.ProcessorHelper" *#
#* @vtlvariable name="ctx" type="org.kevoree.modeling.kotlin.generator.GenerationContext" *#
#* @vtlvariable name="packElem" type="java.lang.String" *#
##if(!$currentClass.getEAllReferences().isEmpty())
override fun visit(visitor : org.kevoree.modeling.api.util.ModelVisitor, recursive : Boolean, containedReference : Boolean,nonContainedReference : Boolean){
visitor.beginVisitElem(this)
#set($firstGeneratedCont = true)
#foreach( $ref in $currentClass.getEAllContainments())
#if($firstGeneratedCont)
if(containedReference){
#set($firstGeneratedCont = false)
#end
visitor.beginVisitRef(${FQNHelper.fqn($ctx, ${ctx.getBasePackageForUtilitiesGeneration()})}.util.Constants.Ref_${ref.getName()}, ${FQNHelper.fqn($ctx, ${ctx.getBasePackageForUtilitiesGeneration()})}.util.Constants.${FQNHelper.fqn($ctx, $ref.getEReferenceType()).replace(".", "_")})
#if($ref.isMany())
for(KMFLoopEntryKey in _${ref.getName()}.keySet()){
internal_visit(visitor,_${ref.getName()}.get(KMFLoopEntryKey),recursive,containedReference,nonContainedReference,${FQNHelper.fqn($ctx, ${ctx.getBasePackageForUtilitiesGeneration()})}.util.Constants.Ref_${ref.getName()})
}
#else
internal_visit(visitor,${FQNHelper.protectReservedWords(${ref.getName()})},recursive,containedReference,nonContainedReference,${FQNHelper.fqn($ctx, ${ctx.getBasePackageForUtilitiesGeneration()})}.util.Constants.Ref_${ref.getName()})
#end
visitor.endVisitRef(${FQNHelper.fqn($ctx, ${ctx.getBasePackageForUtilitiesGeneration()})}.util.Constants.Ref_${ref.getName()})
#end
#if(!$firstGeneratedCont)
}
#end
#set($firstGeneratedRef = true)
#foreach( $ref in $currentClass.getEAllReferences())
#if(!$currentClass.getEAllContainments().contains($ref))
#if($firstGeneratedRef)
if(nonContainedReference){
#set($firstGeneratedRef = false)
#end
visitor.beginVisitRef(${FQNHelper.fqn($ctx, ${ctx.getBasePackageForUtilitiesGeneration()})}.util.Constants.Ref_${ref.getName()}, ${FQNHelper.fqn($ctx, ${ctx.getBasePackageForUtilitiesGeneration()})}.util.Constants.${FQNHelper.fqn($ctx, $ref.getEReferenceType()).replace(".", "_")})
#if($ref.isMany())
for(KMFLoopEntryKey in _${ref.getName()}.keySet()){
internal_visit(visitor,_${ref.getName()}.get(KMFLoopEntryKey),recursive,containedReference,nonContainedReference,${FQNHelper.fqn($ctx, ${ctx.getBasePackageForUtilitiesGeneration()})}.util.Constants.Ref_${ref.getName()})
}
#else
internal_visit(visitor,${FQNHelper.protectReservedWords(${ref.getName()})},recursive,containedReference,nonContainedReference,${FQNHelper.fqn($ctx, ${ctx.getBasePackageForUtilitiesGeneration()})}.util.Constants.Ref_${ref.getName()})
#end
visitor.endVisitRef(${FQNHelper.fqn($ctx, ${ctx.getBasePackageForUtilitiesGeneration()})}.util.Constants.Ref_${ref.getName()})
#end
#end
#if(!$firstGeneratedRef)
}
#end
visitor.endVisitElem(this)
}
##end
#if(!$currentClass.getEAllAttributes().isEmpty())
override fun visitAttributes(visitor : org.kevoree.modeling.api.util.ModelAttributeVisitor){
#foreach( $att in ${FQNHelper.noduplicate($currentClass.getEAllAttributes())})
visitor.visit(${FQNHelper.protectReservedWords($att.getName())},${FQNHelper.fqn($ctx, ${ctx.getBasePackageForUtilitiesGeneration()})}.util.Constants.Att_${att.getName()},this)
#end
}
#end
© 2015 - 2025 Weber Informatics LLC | Privacy Policy