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);
}
Aggregations