public static Annotation of(Class<? extends Annotation> annotation) { return (Annotation) Proxy.newProxyInstance(annotation.getClassLoader(), new Class[] {annotation}, new DefaultAnnotation(annotation)); }
public ExternalScope(Class<? extends Annotation> scope, boolean normal, boolean passivating) { this.scope = scope; this.normal = normal; this.passivating = passivating; scopeAnnotation = DefaultAnnotation.of(scope); }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if ("hashCode".equals(method.getName())) { return hashCode(); } else if ("equals".equals(method.getName())) { return equals(args[0]); } else if ("annotationType".equals(method.getName())) { return annotationType(); } else if ("toString".equals(method.getName())) { return toString(); } return method.getDefaultValue(); }
StringBuilder sb = new StringBuilder("@" + annotationType().getName() + "("); int lenght = methods.length; try memberValue = invoke(this, methods[i], EMPTY_OBJECT_ARRAY);