Search in sources :

Example 6 with Access

use of javax.persistence.Access in project querydsl by querydsl.

the class JPAConfiguration method getConfig.

@Override
public VisitorConfig getConfig(TypeElement e, List<? extends Element> elements) {
    Access access = e.getAnnotation(Access.class);
    if (access != null) {
        if (access.value() == AccessType.FIELD) {
            return VisitorConfig.FIELDS_ONLY;
        } else {
            return VisitorConfig.METHODS_ONLY;
        }
    }
    boolean fields = false, methods = false;
    for (Element element : elements) {
        if (hasRelevantAnnotation(element)) {
            fields |= element.getKind().equals(ElementKind.FIELD);
            methods |= element.getKind().equals(ElementKind.METHOD);
        }
    }
    return VisitorConfig.get(fields, methods, VisitorConfig.ALL);
}
Also used : VariableElement(javax.lang.model.element.VariableElement) TypeElement(javax.lang.model.element.TypeElement) ExecutableElement(javax.lang.model.element.ExecutableElement) Element(javax.lang.model.element.Element) Access(javax.persistence.Access)

Aggregations

Access (javax.persistence.Access)6 MappingException (org.hibernate.MappingException)4 Element (javax.lang.model.element.Element)1 ExecutableElement (javax.lang.model.element.ExecutableElement)1 TypeElement (javax.lang.model.element.TypeElement)1 VariableElement (javax.lang.model.element.VariableElement)1 AccessType (javax.persistence.AccessType)1 AnnotationException (org.hibernate.AnnotationException)1 AnnotationDescriptor (org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor)1 XProperty (org.hibernate.annotations.common.reflection.XProperty)1 Origin (org.hibernate.boot.jaxb.Origin)1 ClassLoaderAccess (org.hibernate.boot.spi.ClassLoaderAccess)1 AccessType (org.hibernate.cfg.AccessType)1