All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
vTemplates.ClassImplTemplate.vm Maven / Gradle / Ivy
#set($classDeclaration = $context.classDeclaration)
package ${classDeclaration.pack}.impl;
public class ${classDeclaration.name}Impl extends #if($classDeclaration.isInferred()) org.kevoree.modeling.abs.AbstractKObjectInfer #else org.kevoree.modeling.abs.AbstractKObject #end implements ${classDeclaration.pack}.${classDeclaration.name} {
public ${classDeclaration.name}Impl(long p_universe, long p_time, long p_uuid, org.kevoree.modeling.meta.KMetaClass p_metaClass, org.kevoree.modeling.memory.manager.internal.KInternalDataManager p_manager, long p_previousUniverse, long p_previoustTime) {
super(p_universe, p_time, p_uuid, p_metaClass, p_manager,p_previousUniverse,p_previoustTime);
}
#foreach($attribute in $classDeclaration.attributes)
@Override
public $context.generationContext.getHelper().convertToJavaType(${attribute.getType()}) get${context.generationContext.helper.toCamelCase($attribute.getName())}() {
return ($context.generationContext.getHelper().convertToJavaType($attribute.getType())) get(${classDeclaration.pack}.meta.Meta${classDeclaration.name}.ATT_${attribute.getName().toUpperCase()});
}
@Override
public ${classDeclaration.pack}.${classDeclaration.name} set${context.generationContext.helper.toCamelCase(${attribute.getName()})}($context.generationContext.getHelper().convertToJavaType(${attribute.getType()}) p_obj) {
set(${classDeclaration.pack}.meta.Meta${classDeclaration.name}.ATT_${attribute.getName().toUpperCase()}, p_obj);
return this;
}
#end
#foreach($ref in $classDeclaration.references)
#if($ref.visible)
#if($ref.single)
@Override
public ${classDeclaration.pack}.${classDeclaration.name} set${context.generationContext.helper.toCamelCase(${ref.getName()})}(${ref.getType().fqn} p_obj) {
mutate(org.kevoree.modeling.KActionType.SET, ${classDeclaration.pack}.meta.Meta${classDeclaration.name}.REF_${ref.getName().toUpperCase()}, p_obj);
return this;
}
@Override
public void get${context.generationContext.helper.toCamelCase(${ref.getName()})}(final org.kevoree.modeling.KCallback<${ref.getType().fqn}> cb) {
if(cb == null){
return;
}
this.ref(${classDeclaration.pack}.meta.Meta${classDeclaration.name}.REF_${ref.getName().toUpperCase()}, new org.kevoree.modeling.KCallback() {
@Override
public void on(org.kevoree.modeling.KObject[] kObjects) {
if(kObjects.length >0){
cb.on((${ref.getType().fqn}) kObjects[0]);
} else {
cb.on(null);
}
}
});
}
#{else}
@Override
public ${classDeclaration.pack}.${classDeclaration.name} add${context.generationContext.helper.toCamelCase(${ref.getName()})}(${ref.getType().fqn} p_obj) {
mutate(org.kevoree.modeling.KActionType.ADD, ${classDeclaration.pack}.meta.Meta${classDeclaration.name}.REF_${ref.getName().toUpperCase()}, p_obj);
return this;
}
@Override
public ${classDeclaration.pack}.${classDeclaration.name} remove${context.generationContext.helper.toCamelCase(${ref.getName()})}(${ref.getType().fqn} p_obj) {
mutate(org.kevoree.modeling.KActionType.REMOVE, ${classDeclaration.pack}.meta.Meta${classDeclaration.name}.REF_${ref.getName().toUpperCase()}, p_obj);
return this;
}
@Override
public void get${context.generationContext.helper.toCamelCase(${ref.getName()})}(final org.kevoree.modeling.KCallback<${ref.getType().fqn}[]> cb) {
if(cb == null){
return;
}
this.ref(${classDeclaration.pack}.meta.Meta${classDeclaration.name}.REF_${ref.getName().toUpperCase()}, new org.kevoree.modeling.KCallback() {
@Override
public void on(org.kevoree.modeling.KObject[] kObjects) {
${ref.getType().fqn}[] casted = new ${ref.getType().fqn}[kObjects.length];
for(int i=0;i p_result){
Object[] ${operation.name}_params = new Object[$operation.inputParams.size()];
#set($paramIndex = 0)
#foreach($p in $operation.inputParams)
${operation.name}_params[$paramIndex] = p_$p.name;
#set($paramIndex = $paramIndex + 1)
#{end}
_manager.operationManager().call(this, ${classDeclaration.pack}.meta.Meta${classDeclaration.name}.OP_${operation.name.toUpperCase()}, ${operation.name}_params, new org.kevoree.modeling.KCallback() {
public void on(Object o) {
p_result.on((#if(${operation.returnParam})$operation.returnParam.type#{else}Boolean#end)o);
}
});
}
#end
#if($classDeclaration.isInferred())
#set($i = 0)
public void train(#foreach($dependency in $classDeclaration.dependencies)#if($i!=0), #end${dependency.type.pack}.$dependency.type.name $dependency.name#set($i=$i+1)#end#foreach($output in $classDeclaration.outputs)#if($i!=0), #end${context.generationContext.getHelper().getInstance().convertToJavaType(${output.type})} $output.name#set($i=$i+1)#end#if($i!=0),#end org.kevoree.modeling.KCallback callback){
genericTrain(new org.kevoree.modeling.KObject[]{#foreach($dependency in $classDeclaration.dependencies)${dependency.name}#end},new Object[]{#foreach($output in $classDeclaration.outputs)${output.name}#end},callback);
}
#set($i = 0)
public void trainAll(#foreach($dependency in $classDeclaration.dependencies)#if($i!=0), #end${dependency.type.pack}.${dependency.type.name}[] ${dependency.name}#set($i=$i+1)#end#foreach($output in $classDeclaration.outputs)#if($i!=0), #end${context.generationContext.getHelper().getInstance().convertToJavaType(${output.type})} $output.name#set($i=$i+1)#end#if($i!=0),#end org.kevoree.modeling.KCallback callback){
}
#set($i = 0)
public void infer(#foreach($dependency in $classDeclaration.dependencies)#if($i!=0), #end${dependency.type.pack}.$dependency.type.name ${dependency.name}#set($i=$i+1)#end #if($i!=0),#end #if($classDeclaration.multipleOutput()) org.kevoree.modeling.KCallback callback #else org.kevoree.modeling.KCallback<#foreach($output in $classDeclaration.outputs) ${context.generationContext.getHelper().getInstance().convertToJavaType(${output.type})} #end> callback #end){
}
#set($i = 0)
public void inferAll(#foreach($dependency in $classDeclaration.dependencies)#if($i!=0), #end${dependency.type.pack}.${dependency.type.name}[] ${dependency.name}#set($i=$i+1)#end #if($i!=0),#end #if($classDeclaration.multipleOutput()) org.kevoree.modeling.KCallback callback #else org.kevoree.modeling.KCallback<#foreach($output in $classDeclaration.outputs) ${context.generationContext.getHelper().getInstance().convertToJavaType(${output.type})} #end []> callback #end){
//TODO
}
#end
}
#* @vtlvariable name="context" type="org.kevoree.modeling.generator.ClassGenerationContext" *#
#* @vtlvariable name="classDeclaration" type="org.kevoree.modeling.ast.MModelClass" *#