use of org.eclipse.persistence.mappings.AggregateObjectMapping in project cuba by cuba-platform.
the class EmbeddedAttributesMappingProcessor method process.
@Override
public void process(MappingProcessorContext context) {
DatabaseMapping mapping = context.getMapping();
if (mapping instanceof AggregateObjectMapping) {
ClassDescriptor descriptor = mapping.getDescriptor();
Field referenceField = FieldUtils.getFieldsListWithAnnotation(descriptor.getJavaClass(), EmbeddedParameters.class).stream().filter(f -> f.getName().equals(mapping.getAttributeName())).findFirst().orElse(null);
if (referenceField != null) {
EmbeddedParameters embeddedParameters = referenceField.getAnnotation(EmbeddedParameters.class);
if (!embeddedParameters.nullAllowed())
((AggregateObjectMapping) mapping).setIsNullAllowed(false);
}
}
}
Aggregations