@Override public <T extends Annotation> T getAnnotation(final Class<T> clazz) { return Meta.getAnnotation(field, clazz); }
@Override public <T extends Annotation> T getAnnotation(final Class<T> clazz) { return Meta.getAnnotation(annotations, clazz); }
@Override public <T extends Annotation> T getAnnotation(final Class<T> clazz) { return Meta.getAnnotation(annotations, clazz); }
@Override public <T extends Annotation> T getAnnotation(final Class<T> clazz) { return Meta.getAnnotation(field, clazz); }
@Override public <T extends Annotation> T getAnnotation(final Class<T> clazz) { return Meta.getAnnotation(method, clazz); }
@Override public <T extends Annotation> T getAnnotation(final Class<T> clazz) { return Meta.getAnnotation(method, clazz); }
@Override public <T extends Annotation> T getClassOrPackageAnnotation(final Class<T> clazz) { return Meta.getAnnotation(clazz.getPackage(), clazz); }
@Override public <T extends Annotation> T getClassOrPackageAnnotation(final Class<T> clazz) { final Class<?> declaringClass = field.getDeclaringClass(); final T annotation = Meta.getAnnotation(declaringClass, clazz); return annotation == null ? Meta.getAnnotation(declaringClass.getPackage(), clazz) : annotation; }
@Override public <T extends Annotation> T getClassOrPackageAnnotation(final Class<T> clazz) { final Class<?> declaringClass = field.getDeclaringClass(); final T annotation = Meta.getAnnotation(declaringClass, clazz); return annotation == null ? Meta.getAnnotation(declaringClass.getPackage(), clazz) : annotation; }
@Override public <T extends Annotation> T getClassOrPackageAnnotation(final Class<T> clazz) { final Class<?> declaringClass = method.getDeclaringClass(); final T annotation = Meta.getAnnotation(declaringClass, clazz); return annotation == null ? Meta.getAnnotation(declaringClass.getPackage(), clazz) : annotation; }
@Override public <T extends Annotation> T getClassOrPackageAnnotation(final Class<T> clazz) { final Class<?> declaringClass = method.getDeclaringClass(); final T annotation = Meta.getAnnotation(declaringClass, clazz); return annotation == null ? Meta.getAnnotation(declaringClass.getPackage(), clazz) : annotation; }
@Override public <T extends Annotation> T getClassOrPackageAnnotation(final Class<T> clazz) { return Meta.getAnnotation(clazz.getPackage(), clazz); }
private String extractKey(final String name, final Method from, final Method or) { JohnzonProperty property = Meta.getAnnotation(from, JohnzonProperty.class); if (property == null && or != null) { property = Meta.getAnnotation(or, JohnzonProperty.class); } return property != null ? property.value() : name; }
private String extractKey(final String name, final Method from, final Method or) { JohnzonProperty property = Meta.getAnnotation(from, JohnzonProperty.class); if (property == null && or != null) { property = Meta.getAnnotation(or, JohnzonProperty.class); } return property != null ? property.value() : name; }
private String extractKey(final Field f, final String key) { final JohnzonProperty property = Meta.getAnnotation(f, JohnzonProperty.class); return property != null ? property.value() : key; }
private String extractKey(final Field f, final String key) { final JohnzonProperty property = Meta.getAnnotation(f, JohnzonProperty.class); return property != null ? property.value() : key; }
@Override public Map<String, Reader> doFindReaders(final Class<?> clazz) { final Map<String, Reader> readers = new HashMap<String, Reader>(); for (final Map.Entry<String, Field> f : fields(clazz, true).entrySet()) { final String key = f.getKey(); if (isIgnored(key) || Meta.getAnnotation(f.getValue(), JohnzonAny.class) != null) { continue; } final Field field = f.getValue(); readers.put(extractKey(field, key), new FieldReader(field, field.getGenericType())); } return readers; }
@Override public Map<String, Reader> doFindReaders(final Class<?> clazz) { final Map<String, Reader> readers = new HashMap<String, Reader>(); for (final Map.Entry<String, Field> f : fields(clazz, true).entrySet()) { final String key = f.getKey(); if (isIgnored(key) || Meta.getAnnotation(f.getValue(), JohnzonAny.class) != null) { continue; } final Field field = f.getValue(); readers.put(extractKey(field, key), new FieldReader(field, field.getGenericType())); } return readers; }
@Override public Map<String, Reader> doFindReaders(final Class<?> clazz) { final Map<String, Reader> readers = new HashMap<String, Reader>(); final PropertyDescriptor[] propertyDescriptors = getPropertyDescriptors(clazz); for (final PropertyDescriptor descriptor : propertyDescriptors) { final Method readMethod = descriptor.getReadMethod(); if (readMethod != null && readMethod.getDeclaringClass() != Object.class) { if (isIgnored(descriptor.getName()) || Meta.getAnnotation(readMethod, JohnzonAny.class) != null) { continue; } readers.put(extractKey(descriptor.getName(), readMethod, null), new MethodReader(readMethod, readMethod.getGenericReturnType())); } } return readers; }
@Override public Map<String, Reader> doFindReaders(final Class<?> clazz) { final Map<String, Reader> readers = new HashMap<String, Reader>(); final PropertyDescriptor[] propertyDescriptors = getPropertyDescriptors(clazz); for (final PropertyDescriptor descriptor : propertyDescriptors) { final Method readMethod = descriptor.getReadMethod(); if (readMethod != null && readMethod.getDeclaringClass() != Object.class) { if (isIgnored(descriptor.getName()) || Meta.getAnnotation(readMethod, JohnzonAny.class) != null) { continue; } readers.put(extractKey(descriptor.getName(), readMethod, null), new MethodReader(readMethod, readMethod.getGenericReturnType())); } } return readers; }