use of com.blazebit.persistence.view.MappingParameter in project blaze-persistence by Blazebit.
the class AnnotationMappingReader method getMapping.
public static Annotation getMapping(String attributeName, AnnotatedElement annotatedElement, boolean implicitMapping) {
Mapping mapping = annotatedElement.getAnnotation(Mapping.class);
if (mapping == null) {
IdMapping idMapping = annotatedElement.getAnnotation(IdMapping.class);
if (idMapping != null) {
if (idMapping.value().isEmpty()) {
idMapping = new IdMappingLiteral(attributeName);
}
return idMapping;
}
MappingParameter mappingParameter = annotatedElement.getAnnotation(MappingParameter.class);
if (mappingParameter != null) {
return mappingParameter;
}
MappingSubquery mappingSubquery = annotatedElement.getAnnotation(MappingSubquery.class);
if (mappingSubquery != null) {
return mappingSubquery;
}
MappingCorrelated mappingCorrelated = annotatedElement.getAnnotation(MappingCorrelated.class);
if (mappingCorrelated != null) {
return mappingCorrelated;
}
MappingCorrelatedSimple mappingCorrelatedSimple = annotatedElement.getAnnotation(MappingCorrelatedSimple.class);
if (mappingCorrelatedSimple != null) {
return mappingCorrelatedSimple;
}
if (implicitMapping) {
mapping = new MappingLiteral(attributeName);
} else {
return null;
}
}
if (mapping.value().isEmpty()) {
mapping = new MappingLiteral(attributeName, mapping);
}
return mapping;
}
use of com.blazebit.persistence.view.MappingParameter in project blaze-persistence by Blazebit.
the class AnnotationMappingReader method getMapping.
public static Annotation getMapping(AnnotatedElement annotatedElement, Constructor<?> constructor, int index, MetamodelBootContext context) {
if (annotatedElement.isAnnotationPresent(IdMapping.class)) {
context.addError("The @IdMapping annotation is disallowed for entity view constructors for the " + ParameterAttributeMapping.getLocation(constructor, index));
return null;
}
Mapping mapping = annotatedElement.getAnnotation(Mapping.class);
if (mapping != null) {
return mapping;
}
MappingParameter mappingParameter = annotatedElement.getAnnotation(MappingParameter.class);
if (mappingParameter != null) {
return mappingParameter;
}
MappingSubquery mappingSubquery = annotatedElement.getAnnotation(MappingSubquery.class);
if (mappingSubquery != null) {
return mappingSubquery;
}
MappingCorrelated mappingCorrelated = annotatedElement.getAnnotation(MappingCorrelated.class);
if (mappingCorrelated != null) {
return mappingCorrelated;
}
MappingCorrelatedSimple mappingCorrelatedSimple = annotatedElement.getAnnotation(MappingCorrelatedSimple.class);
if (mappingCorrelatedSimple != null) {
return mappingCorrelatedSimple;
}
Self self = annotatedElement.getAnnotation(Self.class);
if (self != null) {
return self;
}
context.addError("No entity view mapping annotation given for the " + ParameterAttributeMapping.getLocation(constructor, index));
return null;
}
Aggregations