All Downloads are FREE. Search and download functionalities are using the official Maven repository.

vTemplates.MetaEnumTemplate.vm Maven / Gradle / Ivy

There is a newer version: 4.26.0
Show newest version
package ${context.pack}.meta;

public class Meta${context.getName()} implements org.kevoree.modeling.KType {

    private static Meta${context.getName()} INSTANCE;
    public static Meta${context.getName()} getInstance() {
        if(INSTANCE == null) {
            INSTANCE = new Meta${context.getName()}();
        }
        return INSTANCE;
    }

#set($i = 0)
#foreach($enumAtt in ${context.litterals})
    public static final org.kevoree.modeling.meta.KLiteral $enumAtt.toUpperCase() = new org.kevoree.modeling.meta.impl.MetaLiteral("$enumAtt.toUpperCase()",$i,"${context.getFqn()}");
    #set($i = $i +1)
#end
#set($i = 1)

    public static final org.kevoree.modeling.meta.KLiteral[] values = new org.kevoree.modeling.meta.KLiteral[]{#foreach($enumAtt in ${context.litterals})$enumAtt.toUpperCase()#if($i<${context.litterals.size()}), #end#set($i = $i +1)#end};
    public static org.kevoree.modeling.meta.KLiteral valueOf(String s) {
        for(int i = 0; i < values.length; i++) {
            if(s.equals(values[i].metaName())){
                return values[i];
            }
        }
        return null;
    }

    @Override
    public String name() {
        return "${context.getFqn()}";
    }

    @Override
    public boolean isEnum() {
        return true;
    }

    @Override
    public int id() {
        return ${context.index};
    }

}

#* @vtlvariable name="context" type="org.kevoree.modeling.ast.MModelEnum" *#




© 2015 - 2024 Weber Informatics LLC | Privacy Policy