Search in sources :

Example 1 with AnnotationMetaEntity

use of org.hibernate.jpamodelgen.annotation.AnnotationMetaEntity in project hibernate-orm by hibernate.

the class JPAMetaModelEntityProcessor method handleRootElementAnnotationMirrors.

private void handleRootElementAnnotationMirrors(final Element element) {
    List<? extends AnnotationMirror> annotationMirrors = element.getAnnotationMirrors();
    for (AnnotationMirror mirror : annotationMirrors) {
        if (!ElementKind.CLASS.equals(element.getKind())) {
            continue;
        }
        String fqn = ((TypeElement) element).getQualifiedName().toString();
        MetaEntity alreadyExistingMetaEntity = tryGettingExistingEntityFromContext(mirror, fqn);
        if (alreadyExistingMetaEntity != null && alreadyExistingMetaEntity.isMetaComplete()) {
            String msg = "Skipping processing of annotations for " + fqn + " since xml configuration is metadata complete.";
            context.logMessage(Diagnostic.Kind.OTHER, msg);
            continue;
        }
        boolean requiresLazyMemberInitialization = false;
        AnnotationMetaEntity metaEntity;
        if (TypeUtils.containsAnnotation(element, Constants.EMBEDDABLE) || TypeUtils.containsAnnotation(element, Constants.MAPPED_SUPERCLASS)) {
            requiresLazyMemberInitialization = true;
        }
        metaEntity = new AnnotationMetaEntity((TypeElement) element, context, requiresLazyMemberInitialization);
        if (alreadyExistingMetaEntity != null) {
            metaEntity.mergeInMembers(alreadyExistingMetaEntity);
        }
        addMetaEntityToContext(mirror, metaEntity);
    }
}
Also used : AnnotationMirror(javax.lang.model.element.AnnotationMirror) AnnotationMetaEntity(org.hibernate.jpamodelgen.annotation.AnnotationMetaEntity) MetaEntity(org.hibernate.jpamodelgen.model.MetaEntity) AnnotationMetaEntity(org.hibernate.jpamodelgen.annotation.AnnotationMetaEntity) TypeElement(javax.lang.model.element.TypeElement)

Aggregations

AnnotationMirror (javax.lang.model.element.AnnotationMirror)1 TypeElement (javax.lang.model.element.TypeElement)1 AnnotationMetaEntity (org.hibernate.jpamodelgen.annotation.AnnotationMetaEntity)1 MetaEntity (org.hibernate.jpamodelgen.model.MetaEntity)1