Search in sources :

Example 1 with EnumLiteralDescr

use of org.drools.drl.ast.descr.EnumLiteralDescr in project drools by kiegroup.

the class EnumGenerator method generate.

public TypeDeclaration generate(EnumDeclarationDescr enumDeclarationDescr) {
    NodeList<Modifier> modifiers = nodeList(Modifier.publicModifier());
    enumDeclaration = new EnumDeclaration(modifiers, enumDeclarationDescr.getFullTypeName());
    for (Map.Entry<String, TypeFieldDescr> field : enumDeclarationDescr.getFields().entrySet()) {
        addField(field);
    }
    for (EnumLiteralDescr enumLiteral : enumDeclarationDescr.getLiterals()) {
        addEnumerationValue(enumLiteral);
    }
    createConstructor(enumDeclarationDescr);
    return enumDeclaration;
}
Also used : TypeFieldDescr(org.drools.drl.ast.descr.TypeFieldDescr) Modifier(com.github.javaparser.ast.Modifier) Map(java.util.Map) EnumDeclaration(com.github.javaparser.ast.body.EnumDeclaration) EnumLiteralDescr(org.drools.drl.ast.descr.EnumLiteralDescr)

Aggregations

Modifier (com.github.javaparser.ast.Modifier)1 EnumDeclaration (com.github.javaparser.ast.body.EnumDeclaration)1 Map (java.util.Map)1 EnumLiteralDescr (org.drools.drl.ast.descr.EnumLiteralDescr)1 TypeFieldDescr (org.drools.drl.ast.descr.TypeFieldDescr)1