public static AnnotatedElement getAnnotatedElement(Class<?> beanClass, String propertyName, Class<?> propertyClass) { Field field = getFieldOrNull(beanClass, propertyName); Method method = getGetterOrNull(beanClass, propertyName, propertyClass); if (field == null || field.getAnnotations().length == 0) { return (method != null && method.getAnnotations().length > 0) ? method : EMPTY; } else if (method == null || method.getAnnotations().length == 0) { return field; } else { return new Annotations(field, method); } }
Annotations ann = new Annotations(field); types.put(field.getName(), propertyType); annotations.put(field.getName(), ann); ann = new Annotations(); annotations.put(propertyName, ann);
blockedProperties.add(name); } else if (configuration.isValidField(field)) { Annotations annotations = new Annotations(); configuration.inspect(field, annotations); annotations.addAnnotation(field.getAnnotation(QueryType.class)); Annotations annotations = propertyAnnotations.get(name); if (annotations == null) { annotations = new Annotations(); propertyAnnotations.put(name, annotations);
public static AnnotatedElement getAnnotatedElement(Class<?> beanClass, String propertyName, Class<?> propertyClass) { Field field = getFieldOrNull(beanClass, propertyName); Method method = getGetterOrNull(beanClass, propertyName, propertyClass); if (field == null || field.getAnnotations().length == 0) { return (method != null && method.getAnnotations().length > 0) ? method : EMPTY; } else if (method == null || method.getAnnotations().length == 0) { return field; } else { return new Annotations(field, method); } }
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; } else { throw new IllegalArgumentException("No property found for " + cl.getName() + "." + propertyName); } }