@Override protected void init(EnhancedAnnotation<T> annotatedAnnotation) { super.init(annotatedAnnotation); if (isValid()) { initInterceptionBindingTypes(annotatedAnnotation); checkArrayAndAnnotationValuedMembers(annotatedAnnotation); checkMetaAnnotations(annotatedAnnotation); this.metaAnnotations = annotatedAnnotation.getAnnotations(); } }
private void checkMetaAnnotations(EnhancedAnnotation<T> annotatedAnnotation) { ElementType[] elementTypes = getTargetElementTypes(annotatedAnnotation.getAnnotation(Target.class)); for (Annotation inheritedBinding : getInheritedInterceptionBindingTypes()) { ElementType[] metaAnnotationElementTypes = getTargetElementTypes(inheritedBinding.annotationType().getAnnotation(Target.class)); if (!Arrays2.containsAll(metaAnnotationElementTypes, elementTypes)) { ReflectionLogger.LOG.invalidInterceptorBindingTargetDeclaration(inheritedBinding.annotationType().getName(), Arrays.toString(metaAnnotationElementTypes), annotatedAnnotation.getJavaClass().getName(), Arrays.toString(elementTypes)); } } }
@Override public Set<Annotation> getInterceptorBindingDefinition(Class<? extends Annotation> bindingType) { InterceptorBindingModel<? extends Annotation> model = getServices().get(MetaAnnotationStore.class).getInterceptorBindingModel(bindingType); if (model.isValid()) { return model.getMetaAnnotations(); } else { throw BeanManagerLogger.LOG.notInterceptorBindingType(bindingType); } }
public boolean isEqual(Annotation instance, Annotation other, boolean includeNonBindingTypes) { if (instance.annotationType().equals(getRawType()) && other.annotationType().equals(getRawType())) { for (AnnotatedMethod<?> annotatedMethod : getAnnotatedAnnotation().getMethods()) { if (includeNonBindingTypes || !getNonBindingMembers().contains(annotatedMethod)) { try { AccessController.doPrivileged(SetAccessibleAction.of(annotatedMethod.getJavaMember())); Object thisValue = annotatedMethod.getJavaMember().invoke(instance); Object thatValue = annotatedMethod.getJavaMember().invoke(other); if (!thisValue.equals(thatValue)) { return false; } } catch (IllegalArgumentException e) { throw new WeldException(e); } catch (IllegalAccessException e) { throw new WeldException(e); } catch (InvocationTargetException e) { throw new WeldException(e); } } } return true; } return false; } }
private void checkArrayAndAnnotationValuedMembers(EnhancedAnnotation<T> annotatedAnnotation) { for (EnhancedAnnotatedMethod<?, ?> annotatedMethod : annotatedAnnotation.getMembers()) { if ((Reflections.isArrayType(annotatedMethod.getJavaClass()) || Annotation.class.isAssignableFrom(annotatedMethod.getJavaClass())) && !getNonBindingMembers().contains(annotatedMethod.slim())) { throw MetadataLogger.LOG.nonBindingMemberTypeException(annotatedMethod); } } }
private static void addInheritedInterceptorBindings(Class<? extends Annotation> bindingType, MetaAnnotationStore store, Set<Annotation> inheritedBindings) { Set<Annotation> metaBindings = store.getInterceptorBindingModel(bindingType).getInheritedInterceptionBindingTypes(); inheritedBindings.addAll(metaBindings); for (Annotation metaBinding : metaBindings) { addInheritedInterceptorBindings(metaBinding.annotationType(), store, inheritedBindings); } }
@Override public InterceptorBindingModel<Annotation> apply(Class<Annotation> from) { return new InterceptorBindingModel<Annotation>(getClassTransformer().getEnhancedAnnotation(from)); }
public boolean isEqual(Annotation instance, Annotation other, boolean includeNonBindingTypes) { if (instance.annotationType().equals(getRawType()) && other.annotationType().equals(getRawType())) { for (AnnotatedMethod<?> annotatedMethod : getAnnotatedAnnotation().getMethods()) { if (includeNonBindingTypes || !getNonBindingMembers().contains(annotatedMethod)) { try { AccessController.doPrivileged(SetAccessibleAction.of(annotatedMethod.getJavaMember())); Object thisValue = annotatedMethod.getJavaMember().invoke(instance); Object thatValue = annotatedMethod.getJavaMember().invoke(other); if (!thisValue.equals(thatValue)) { return false; } } catch (IllegalArgumentException e) { throw new WeldException(e); } catch (IllegalAccessException e) { throw new WeldException(e); } catch (InvocationTargetException e) { throw new WeldException(e); } } } return true; } return false; } }
private void checkArrayAndAnnotationValuedMembers(EnhancedAnnotation<T> annotatedAnnotation) { for (EnhancedAnnotatedMethod<?, ?> annotatedMethod : annotatedAnnotation.getMembers()) { if ((Reflections.isArrayType(annotatedMethod.getJavaClass()) || Annotation.class.isAssignableFrom(annotatedMethod.getJavaClass())) && !getNonBindingMembers().contains(annotatedMethod.slim())) { throw MetadataLogger.LOG.nonBindingMemberTypeException(annotatedMethod); } } }
private static void addInheritedInterceptorBindings(EnhancedAnnotatedType<?> clazz, Class<? extends Annotation> bindingType, MetaAnnotationStore metaAnnotationStore, Set<Annotation> flattenInterceptorBindings) { Set<Annotation> metaBindings = metaAnnotationStore.getInterceptorBindingModel(bindingType).getInheritedInterceptionBindingTypes(); addInterceptorBindings(clazz, metaBindings, flattenInterceptorBindings, metaAnnotationStore); for (Annotation metaBinding : metaBindings) { addInheritedInterceptorBindings(clazz, metaBinding.annotationType(), metaAnnotationStore, flattenInterceptorBindings); } }
@Override public InterceptorBindingModel<Annotation> apply(Class<Annotation> from) { return new InterceptorBindingModel<Annotation>(getClassTransformer().getEnhancedAnnotation(from)); }
@Override public Set<Annotation> getInterceptorBindingDefinition(Class<? extends Annotation> bindingType) { InterceptorBindingModel<? extends Annotation> model = getServices().get(MetaAnnotationStore.class).getInterceptorBindingModel(bindingType); if (model.isValid()) { return model.getMetaAnnotations(); } else { throw BeanManagerLogger.LOG.notInterceptorBindingType(bindingType); } }
private void checkMetaAnnotations(EnhancedAnnotation<T> annotatedAnnotation) { ElementType[] elementTypes = getTargetElementTypes(annotatedAnnotation.getAnnotation(Target.class)); for (Annotation inheritedBinding : getInheritedInterceptionBindingTypes()) { ElementType[] metaAnnotationElementTypes = getTargetElementTypes(inheritedBinding.annotationType().getAnnotation(Target.class)); if (!Arrays2.containsAll(metaAnnotationElementTypes, elementTypes)) { ReflectionLogger.LOG.invalidInterceptorBindingTargetDeclaration(inheritedBinding.annotationType().getName(), Arrays.toString(metaAnnotationElementTypes), annotatedAnnotation.getJavaClass().getName(), Arrays.toString(elementTypes)); } } }
@Override protected void init(EnhancedAnnotation<T> annotatedAnnotation) { super.init(annotatedAnnotation); if (isValid()) { initInterceptionBindingTypes(annotatedAnnotation); checkArrayAndAnnotationValuedMembers(annotatedAnnotation); checkMetaAnnotations(annotatedAnnotation); this.metaAnnotations = annotatedAnnotation.getAnnotations(); } }
public boolean isEqual(Annotation instance, Annotation other, boolean includeNonBindingTypes) { if (instance.annotationType().equals(getRawType()) && other.annotationType().equals(getRawType())) { for (AnnotatedMethod<?> annotatedMethod : getAnnotatedAnnotation().getMethods()) { if (includeNonBindingTypes || !getNonBindingMembers().contains(annotatedMethod)) { try { AccessController.doPrivileged(SetAccessibleAction.of(annotatedMethod.getJavaMember())); Object thisValue = annotatedMethod.getJavaMember().invoke(instance); Object thatValue = annotatedMethod.getJavaMember().invoke(other); if (!thisValue.equals(thatValue)) { return false; } } catch (IllegalArgumentException e) { throw new WeldException(e); } catch (IllegalAccessException e) { throw new WeldException(e); } catch (InvocationTargetException e) { throw new WeldException(e); } } } return true; } return false; } }
private void checkArrayAndAnnotationValuedMembers(EnhancedAnnotation<T> annotatedAnnotation) { for (EnhancedAnnotatedMethod<?, ?> annotatedMethod : annotatedAnnotation.getMembers()) { if ((Reflections.isArrayType(annotatedMethod.getJavaClass()) || Annotation.class.isAssignableFrom(annotatedMethod.getJavaClass())) && !getNonBindingMembers().contains(annotatedMethod.slim())) { throw MetadataLogger.LOG.nonBindingMemberTypeException(annotatedMethod); } } }
private static void addInheritedInterceptorBindings(EnhancedAnnotatedType<?> clazz, Class<? extends Annotation> bindingType, MetaAnnotationStore metaAnnotationStore, Set<Annotation> flattenInterceptorBindings) { Set<Annotation> metaBindings = metaAnnotationStore.getInterceptorBindingModel(bindingType).getInheritedInterceptionBindingTypes(); addInterceptorBindings(clazz, metaBindings, flattenInterceptorBindings, metaAnnotationStore); for (Annotation metaBinding : metaBindings) { addInheritedInterceptorBindings(clazz, metaBinding.annotationType(), metaAnnotationStore, flattenInterceptorBindings); } }
@Override public InterceptorBindingModel<Annotation> apply(Class<Annotation> from) { return new InterceptorBindingModel<Annotation>(getClassTransformer().getEnhancedAnnotation(from)); }
@Override public Set<Annotation> getInterceptorBindingDefinition(Class<? extends Annotation> bindingType) { InterceptorBindingModel<? extends Annotation> model = getServices().get(MetaAnnotationStore.class).getInterceptorBindingModel(bindingType); if (model.isValid()) { return model.getMetaAnnotations(); } else { throw BeanManagerLogger.LOG.notInterceptorBindingType(bindingType); } }
private void checkMetaAnnotations(EnhancedAnnotation<T> annotatedAnnotation) { ElementType[] elementTypes = getTargetElementTypes(annotatedAnnotation.getAnnotation(Target.class)); for (Annotation inheritedBinding : getInheritedInterceptionBindingTypes()) { ElementType[] metaAnnotationElementTypes = getTargetElementTypes(inheritedBinding.annotationType().getAnnotation(Target.class)); if (!Arrays2.containsAll(metaAnnotationElementTypes, elementTypes)) { ReflectionLogger.LOG.invalidInterceptorBindingTargetDeclaration(inheritedBinding.annotationType().getName(), Arrays.toString(metaAnnotationElementTypes), annotatedAnnotation.getJavaClass().getName(), Arrays.toString(elementTypes)); } } }