Search in sources :

Example 1 with Self

use of com.blazebit.persistence.view.Self 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;
}
Also used : MappingCorrelatedSimple(com.blazebit.persistence.view.MappingCorrelatedSimple) MappingParameter(com.blazebit.persistence.view.MappingParameter) MappingCorrelated(com.blazebit.persistence.view.MappingCorrelated) EntityViewInheritanceMapping(com.blazebit.persistence.view.EntityViewInheritanceMapping) EntityViewRootMapping(com.blazebit.persistence.view.spi.EntityViewRootMapping) Mapping(com.blazebit.persistence.view.Mapping) IdMapping(com.blazebit.persistence.view.IdMapping) MappingSubquery(com.blazebit.persistence.view.MappingSubquery) Self(com.blazebit.persistence.view.Self)

Aggregations

EntityViewInheritanceMapping (com.blazebit.persistence.view.EntityViewInheritanceMapping)1 IdMapping (com.blazebit.persistence.view.IdMapping)1 Mapping (com.blazebit.persistence.view.Mapping)1 MappingCorrelated (com.blazebit.persistence.view.MappingCorrelated)1 MappingCorrelatedSimple (com.blazebit.persistence.view.MappingCorrelatedSimple)1 MappingParameter (com.blazebit.persistence.view.MappingParameter)1 MappingSubquery (com.blazebit.persistence.view.MappingSubquery)1 Self (com.blazebit.persistence.view.Self)1 EntityViewRootMapping (com.blazebit.persistence.view.spi.EntityViewRootMapping)1