Package com.mysema.util

Examples of com.mysema.util.Annotations


    protected AnnotatedElement getAnnotatedElement(Class<?> cl, String propertyName) throws NoSuchMethodException {
        Field field = ReflectionUtils.getFieldOrNull(cl, propertyName);
        Method method = ReflectionUtils.getGetterOrNull(cl, propertyName);
        if (field != null) {
            if (method != null) {
                return new Annotations(field, method);
            } else {
                return field;
            }
        } else if (method != null) {
            return method;
View Full Code Here


            for (VariableElement field : ElementFilter.fieldsIn(elements)) {
                String name = field.getSimpleName().toString();
                if (configuration.isBlockedField(field)) {
                    blockedProperties.add(name);
                } else if (configuration.isValidField(field)) {
                    Annotations annotations = new Annotations();
                    configuration.inspect(field, annotations);
                    annotations.addAnnotation(field.getAnnotation(QueryType.class));
                    annotations.addAnnotation(field.getAnnotation(QueryInit.class));
                    propertyAnnotations.put(name, annotations);
                    propertyTypes.put(name, field.asType());
                    TypeMirror fixedType = configuration.getRealType(field);
                    if (fixedType != null) {
                        fixedTypes.put(name, fixedType);
                    }
                }
            }
        }

        // methods
        if (config.visitMethodProperties()) {
            for (ExecutableElement method : ElementFilter.methodsIn(elements)) {
                String name = method.getSimpleName().toString();
                if (name.startsWith("get") && name.length() > 3 && method.getParameters().isEmpty()) {
                    name = BeanUtils.uncapitalize(name.substring(3));
                } else if (name.startsWith("is") && name.length() > 2 && method.getParameters().isEmpty()) {
                    name = BeanUtils.uncapitalize(name.substring(2));
                } else {
                    continue;
                }

                if (configuration.isBlockedGetter(method)) {
                    blockedProperties.add(name);
                } else if (configuration.isValidGetter(method) && !blockedProperties.contains(name)) {
                    Annotations annotations = propertyAnnotations.get(name);
                    if (annotations == null) {
                        annotations = new Annotations();
                        propertyAnnotations.put(name, annotations);
                    }
                    configuration.inspect(method, annotations);
                    annotations.addAnnotation(method.getAnnotation(QueryType.class));
                    annotations.addAnnotation(method.getAnnotation(QueryInit.class));
                    propertyTypes.put(name, method.getReturnType());
                    TypeMirror fixedType = configuration.getRealType(method);
                    if (fixedType != null) {
                        fixedTypes.put(name, fixedType);
                    }
View Full Code Here

TOP

Related Classes of com.mysema.util.Annotations

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.