Search in sources :

Example 1 with Declaration

use of org.whole.lang.pojo.model.Declaration in project whole by wholeplatform.

the class PojoNormalizerVisitor method addReferenceTypeMappingDataType.

public static void addReferenceTypeMappingDataType(ReferenceType type, Library entity, IBindingManager bindings, FreshNameGenerator entityNameGenerator) {
    Property property = (Property) bindings.wGet("property");
    Declaration declaration = PojoUtils.findProductDeclaration(type, entity);
    boolean hasDataTypeModifier = property.getAnnotations().wContainsValue(ModifierEnum.DATATYPE);
    boolean needsDeclaration = declaration == null;
    boolean needsModifier = property.equals(type.wGetParent()) && !hasDataTypeModifier && (needsDeclaration || Matcher.matchImpl(PojoEntityDescriptorEnum.DataTypeDeclaration, declaration));
    if (needsModifier)
        property.getAnnotations().wAdd(PojoEntityFactory.instance.createModifier(ModifierEnum.DATATYPE));
    if (needsDeclaration)
        PojoUtils.addDataTypeDeclaration(type, entityNameGenerator.nextFreshName(PojoUtils.calculateTypeName(type)), entity);
}
Also used : PojoDeclaration(org.whole.lang.pojo.model.PojoDeclaration) ProductDeclaration(org.whole.lang.pojo.model.ProductDeclaration) Declaration(org.whole.lang.pojo.model.Declaration) Property(org.whole.lang.pojo.model.Property)

Aggregations

Declaration (org.whole.lang.pojo.model.Declaration)1 PojoDeclaration (org.whole.lang.pojo.model.PojoDeclaration)1 ProductDeclaration (org.whole.lang.pojo.model.ProductDeclaration)1 Property (org.whole.lang.pojo.model.Property)1