Search in sources :

Example 1 with TypeSafe

use of org.kie.api.definition.type.TypeSafe in project drools by kiegroup.

the class TypeDeclarationFactory method processAnnotations.

public static void processAnnotations(AbstractClassTypeDeclarationDescr typeDescr, TypeDeclaration type) {
    Role role = typeDescr.getTypedAnnotation(Role.class);
    if (role != null) {
        type.setRole(role.value());
    }
    TypeSafe typeSafe = typeDescr.getTypedAnnotation(TypeSafe.class);
    if (typeSafe != null) {
        type.setTypesafe(typeSafe.value());
    }
    if (typeDescr instanceof EnumDeclarationDescr) {
        type.setKind(TypeDeclaration.Kind.ENUM);
    } else if (typeDescr instanceof TypeDeclarationDescr && ((TypeDeclarationDescr) typeDescr).isTrait()) {
        type.setKind(TypeDeclaration.Kind.TRAIT);
    }
    type.setDynamic(typeDescr.hasAnnotation(PropertyChangeSupport.class));
}
Also used : Role(org.kie.api.definition.type.Role) TypeDeclarationDescr(org.drools.compiler.lang.descr.TypeDeclarationDescr) AbstractClassTypeDeclarationDescr(org.drools.compiler.lang.descr.AbstractClassTypeDeclarationDescr) EnumDeclarationDescr(org.drools.compiler.lang.descr.EnumDeclarationDescr) PropertyChangeSupport(org.kie.api.definition.type.PropertyChangeSupport) TypeSafe(org.kie.api.definition.type.TypeSafe)

Aggregations

AbstractClassTypeDeclarationDescr (org.drools.compiler.lang.descr.AbstractClassTypeDeclarationDescr)1 EnumDeclarationDescr (org.drools.compiler.lang.descr.EnumDeclarationDescr)1 TypeDeclarationDescr (org.drools.compiler.lang.descr.TypeDeclarationDescr)1 PropertyChangeSupport (org.kie.api.definition.type.PropertyChangeSupport)1 Role (org.kie.api.definition.type.Role)1 TypeSafe (org.kie.api.definition.type.TypeSafe)1