public static <T extends Annotation> T getAnnotation(final Class<?> clazz, final Class<T> api) { final T annotation = clazz.getAnnotation(api); if (annotation != null) { return annotation; } return findMeta(clazz.getAnnotations(), api); }
@Override public <T extends Annotation> T getAnnotation(final Class<T> clazz) { return Meta.getAnnotation(annotations, clazz); }
public static <T extends Annotation> T findMeta(final Annotation[] annotations, final Class<T> api) { for (final Annotation a : annotations) { final Class<? extends Annotation> userType = a.annotationType(); final T aa = userType.getAnnotation(api); if (aa != null) { boolean overriden = false; final Map<String, Method> mapping = new HashMap<String, Method>(); for (final Class<?> cm : asList(api, userType)) { for (final Method m : cm.getMethods()) { overriden = mapping.put(m.getName(), m) != null || overriden; } } if (!overriden) { return aa; } return api.cast(newAnnotation(mapping, a, aa)); } } return null; }
public static <T extends Annotation> T findMeta(final Annotation[] annotations, final Class<T> api) { for (final Annotation a : annotations) { final Class<? extends Annotation> userType = a.annotationType(); final T aa = userType.getAnnotation(api); if (aa != null) { boolean overriden = false; final Map<String, Method> mapping = new HashMap<String, Method>(); for (final Class<?> cm : asList(api, userType)) { for (final Method m : cm.getMethods()) { overriden = mapping.put(m.getName(), m) != null || overriden; } } if (!overriden) { return aa; } return api.cast(newAnnotation(mapping, a, aa)); } } return null; }
@Override public <T extends Annotation> T getAnnotation(final Class<T> clazz) { return Meta.getAnnotation(field, clazz); }
public static <T extends Annotation> T getAnnotation(final Class<?> clazz, final Class<T> api) { final T annotation = clazz.getAnnotation(api); if (annotation != null) { return annotation; } return findMeta(clazz.getAnnotations(), api); }
@Override public <T extends Annotation> T getAnnotation(final Class<T> clazz) { return Meta.getAnnotation(field, clazz); }
public static <T extends Annotation> T getAnnotation(final Package pck, final Class<T> api) { final T annotation = pck.getAnnotation(api); if (annotation != null) { return annotation; } return findMeta(pck.getAnnotations(), api); }
@Override public <T extends Annotation> T getAnnotation(final Class<T> clazz) { return Meta.getAnnotation(method, clazz); }
public static <T extends Annotation> T getAnnotation(final AccessibleObject holder, final Class<T> api) { final T annotation = holder.getAnnotation(api); if (annotation != null) { return annotation; } return findMeta(holder.getAnnotations(), api); }
@Override public <T extends Annotation> T getAnnotation(final Class<T> clazz) { return Meta.getAnnotation(method, clazz); }
private static <T extends Annotation> T getAnnotation(final Parameter param, final Class<T> api) { final T annotation = param.getAnnotation(api); if (annotation != null) { return annotation; } return Meta.findMeta(param.getAnnotations(), api); }
@Override public <T extends Annotation> T getAnnotation(final Class<T> clazz) { return Meta.getAnnotation(annotations, clazz); }
private static <T extends Annotation> T getAnnotation(final Parameter param, final Class<T> api) { final T annotation = param.getAnnotation(api); if (annotation != null) { return annotation; } return Meta.findMeta(param.getAnnotations(), api); }
@Override public <T extends Annotation> T getClassOrPackageAnnotation(final Class<T> clazz) { return Meta.getAnnotation(clazz.getPackage(), clazz); }
public static <T extends Annotation> T getAnnotation(final AccessibleObject holder, final Class<T> api) { final T annotation = holder.getAnnotation(api); if (annotation != null) { return annotation; } return findMeta(holder.getAnnotations(), api); }
@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; }
public static <T extends Annotation> T getAnnotation(final Package pck, final Class<T> api) { final T annotation = pck.getAnnotation(api); if (annotation != null) { return annotation; } return findMeta(pck.getAnnotations(), api); }
@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; }