public static <T, X, Y extends X> EnhancedAnnotatedMethodImpl<T, X> of(AnnotatedMethod<X> annotatedMethod, EnhancedAnnotatedType<Y> declaringClass, ClassTransformer classTransformer) { EnhancedAnnotatedType<X> downcastDeclaringType = Reflections.cast(declaringClass); return new EnhancedAnnotatedMethodImpl<T, X>(annotatedMethod, buildAnnotationMap(annotatedMethod.getAnnotations()), buildAnnotationMap(annotatedMethod.getAnnotations()), downcastDeclaringType, classTransformer); }
public boolean isEquivalent(Method method) { return this.getDeclaringType().isEquivalent(method.getDeclaringClass()) && this.getName().equals(method.getName()) && Arrays.equals(this.getParameterTypesAsArray(), method.getParameterTypes()); }
/** * Constructor * <p/> * Initializes the superclass with the built annotation map * * @param annotationType The annotation type */ protected EnhancedAnnotationImpl(SlimAnnotatedType<T> annotatedType, Map<Class<? extends Annotation>, Annotation> annotationMap, Map<Class<? extends Annotation>, Annotation> declaredAnnotationMap, ClassTransformer classTransformer) { super(annotatedType, annotationMap, declaredAnnotationMap, classTransformer); this.clazz = annotatedType.getJavaClass(); members = new HashSet<EnhancedAnnotatedMethod<?, ?>>(); annotatedMembers = SetMultimap.newSetMultimap(); for (AnnotatedMethod<? super T> annotatedMethod : annotatedType.getMethods()) { EnhancedAnnotatedMethod<?, ? super T> enhancedAnnotatedMethod = EnhancedAnnotatedMethodImpl.of(annotatedMethod, this, classTransformer); members.add(enhancedAnnotatedMethod); for (Annotation annotation : enhancedAnnotatedMethod.getAnnotations()) { annotatedMembers.put(annotation.annotationType(), enhancedAnnotatedMethod); } } }
ArrayList<EnhancedAnnotatedField<?, ? super T>> declaredFieldsTemp = new ArrayList<EnhancedAnnotatedField<?, ? super T>>(); Class<T> javaClass = annotatedType.getJavaClass(); if ((superclass != null) && (superclass.getJavaClass() != Object.class)) { fieldsTemp = Sets.union(fieldsTemp, Reflections.<Set<EnhancedAnnotatedField<?, ? super T>>>cast(superclass.getFields())); if (method.getJavaMember().getDeclaringClass().equals(javaClass)) { EnhancedAnnotatedMethod<?, ? super T> weldMethod = EnhancedAnnotatedMethodImpl.of(method, this, classTransformer); declaredMethodsTemp.add(weldMethod); for (Annotation annotation : weldMethod.getAnnotations()) { declaredAnnotatedMethods.put(annotation.annotationType(), weldMethod); if (weldMethod.getEnhancedParameters(annotationType).size() > 0) { declaredMethodsByAnnotatedParameters.put(annotationType, weldMethod); for (Class<?> interfaceClazz : Reflections.getInterfaceClosure(javaClass)) { if(Reflections.isDefault(interfaceMethod.getJavaMember())) { methodsTemp.add((EnhancedAnnotatedMethod<?, ? super T>) interfaceMethod); EnhancedAnnotatedMethod<?, ? super T> enhancedMethod = EnhancedAnnotatedMethodImpl.of(method, this, classTransformer); methodsTemp.add(enhancedMethod); if (method.getJavaMember().getDeclaringClass().equals(javaClass)) { declaredMethodsTemp.add(enhancedMethod); this.declaredMethodsByAnnotatedParameters = Multimaps.unmodifiableMultimap(declaredMethodsByAnnotatedParameters);
/** * Constructor * <p/> * Initializes the superclass with the built annotation map, sets the method * and declaring class abstraction and detects the actual type arguments * * @param method The underlying method * @param declaringClass The declaring class abstraction */ private EnhancedAnnotatedMethodImpl(AnnotatedMethod<X> annotatedMethod, Map<Class<? extends Annotation>, Annotation> annotationMap, Map<Class<? extends Annotation>, Annotation> declaredAnnotationMap, EnhancedAnnotatedType<X> declaringClass, ClassTransformer classTransformer) { super(annotatedMethod, annotationMap, declaredAnnotationMap, classTransformer, declaringClass); this.slim = annotatedMethod; ArrayList<EnhancedAnnotatedParameter<?, X>> parameters = new ArrayList<EnhancedAnnotatedParameter<?, X>>(annotatedMethod.getParameters().size()); validateParameterCount(annotatedMethod); for (AnnotatedParameter<X> annotatedParameter : annotatedMethod.getParameters()) { EnhancedAnnotatedParameter<?, X> parameter = EnhancedAnnotatedParameterImpl.of(annotatedParameter, this, classTransformer); parameters.add(parameter); } this.parameters = immutableListView(parameters); String propertyName = Reflections.getPropertyName(getDelegate()); if (propertyName == null) { this.propertyName = getName(); } else { this.propertyName = propertyName; } this.signature = new MethodSignatureImpl(this); }
public boolean isGeneric() { return getJavaMember().getTypeParameters().length > 0; }
ArrayList<EnhancedAnnotatedField<?, ? super T>> declaredFieldsTemp = new ArrayList<EnhancedAnnotatedField<?, ? super T>>(); Class<T> javaClass = annotatedType.getJavaClass(); if ((superclass != null) && (superclass.getJavaClass() != Object.class)) { fieldsTemp = Sets.union(fieldsTemp, Reflections.<Set<EnhancedAnnotatedField<?, ? super T>>>cast(superclass.getFields())); if (method.getJavaMember().getDeclaringClass().equals(javaClass)) { EnhancedAnnotatedMethod<?, ? super T> weldMethod = EnhancedAnnotatedMethodImpl.of(method, this, classTransformer); declaredMethodsTemp.add(weldMethod); for (Annotation annotation : weldMethod.getAnnotations()) { declaredAnnotatedMethods.put(annotation.annotationType(), weldMethod); if (weldMethod.getEnhancedParameters(annotationType).size() > 0) { declaredMethodsByAnnotatedParameters.put(annotationType, weldMethod); for (Class<?> interfaceClazz : Reflections.getInterfaceClosure(javaClass)) { if(Reflections.isDefault(interfaceMethod.getJavaMember())) { methodsTemp.add((EnhancedAnnotatedMethod<?, ? super T>) interfaceMethod); EnhancedAnnotatedMethod<?, ? super T> enhancedMethod = EnhancedAnnotatedMethodImpl.of(method, this, classTransformer); methodsTemp.add(enhancedMethod); if (method.getJavaMember().getDeclaringClass().equals(javaClass)) { declaredMethodsTemp.add(enhancedMethod); this.declaredMethodsByAnnotatedParameters = Multimaps.unmodifiableMultimap(declaredMethodsByAnnotatedParameters);
/** * Constructor * <p/> * Initializes the superclass with the built annotation map, sets the method * and declaring class abstraction and detects the actual type arguments * * @param method The underlying method * @param declaringClass The declaring class abstraction */ private EnhancedAnnotatedMethodImpl(AnnotatedMethod<X> annotatedMethod, Map<Class<? extends Annotation>, Annotation> annotationMap, Map<Class<? extends Annotation>, Annotation> declaredAnnotationMap, EnhancedAnnotatedType<X> declaringClass, ClassTransformer classTransformer) { super(annotatedMethod, annotationMap, declaredAnnotationMap, classTransformer, declaringClass); this.slim = annotatedMethod; ArrayList<EnhancedAnnotatedParameter<?, X>> parameters = new ArrayList<EnhancedAnnotatedParameter<?, X>>(annotatedMethod.getParameters().size()); validateParameterCount(annotatedMethod); for (AnnotatedParameter<X> annotatedParameter : annotatedMethod.getParameters()) { EnhancedAnnotatedParameter<?, X> parameter = EnhancedAnnotatedParameterImpl.of(annotatedParameter, this, classTransformer); parameters.add(parameter); } this.parameters = immutableListView(parameters); String propertyName = Reflections.getPropertyName(getDelegate()); if (propertyName == null) { this.propertyName = getName(); } else { this.propertyName = propertyName; } this.signature = new MethodSignatureImpl(this); }
public boolean isGeneric() { return getJavaMember().getTypeParameters().length > 0; }
ArrayList<EnhancedAnnotatedField<?, ? super T>> declaredFieldsTemp = new ArrayList<EnhancedAnnotatedField<?, ? super T>>(); Class<T> javaClass = annotatedType.getJavaClass(); if ((superclass != null) && (superclass.getJavaClass() != Object.class)) { fieldsTemp = Sets.union(fieldsTemp, Reflections.<Set<EnhancedAnnotatedField<?, ? super T>>>cast(superclass.getFields())); if (method.getJavaMember().getDeclaringClass().equals(javaClass)) { EnhancedAnnotatedMethod<?, ? super T> weldMethod = EnhancedAnnotatedMethodImpl.of(method, this, classTransformer); declaredMethodsTemp.add(weldMethod); for (Annotation annotation : weldMethod.getAnnotations()) { declaredAnnotatedMethods.put(annotation.annotationType(), weldMethod); if (weldMethod.getEnhancedParameters(annotationType).size() > 0) { declaredMethodsByAnnotatedParameters.put(annotationType, weldMethod); for (Class<?> interfaceClazz : Reflections.getInterfaceClosure(javaClass)) { if(Reflections.isDefault(interfaceMethod.getJavaMember())) { methodsTemp.add((EnhancedAnnotatedMethod<?, ? super T>) interfaceMethod); EnhancedAnnotatedMethod<?, ? super T> enhancedMethod = EnhancedAnnotatedMethodImpl.of(method, this, classTransformer); methodsTemp.add(enhancedMethod); if (method.getJavaMember().getDeclaringClass().equals(javaClass)) { declaredMethodsTemp.add(enhancedMethod); this.declaredMethodsByAnnotatedParameters = Multimaps.unmodifiableMultimap(declaredMethodsByAnnotatedParameters);
public static <T, X, Y extends X> EnhancedAnnotatedMethodImpl<T, X> of(AnnotatedMethod<X> annotatedMethod, EnhancedAnnotatedType<Y> declaringClass, ClassTransformer classTransformer) { EnhancedAnnotatedType<X> downcastDeclaringType = Reflections.cast(declaringClass); return new EnhancedAnnotatedMethodImpl<T, X>(annotatedMethod, buildAnnotationMap(annotatedMethod.getAnnotations()), buildAnnotationMap(annotatedMethod.getAnnotations()), downcastDeclaringType, classTransformer); }
/** * Constructor * <p/> * Initializes the superclass with the built annotation map, sets the method * and declaring class abstraction and detects the actual type arguments * * @param method The underlying method * @param declaringClass The declaring class abstraction */ private EnhancedAnnotatedMethodImpl(AnnotatedMethod<X> annotatedMethod, Map<Class<? extends Annotation>, Annotation> annotationMap, Map<Class<? extends Annotation>, Annotation> declaredAnnotationMap, EnhancedAnnotatedType<X> declaringClass, ClassTransformer classTransformer) { super(annotatedMethod, annotationMap, declaredAnnotationMap, classTransformer, declaringClass); this.slim = annotatedMethod; ArrayList<EnhancedAnnotatedParameter<?, X>> parameters = new ArrayList<EnhancedAnnotatedParameter<?, X>>(annotatedMethod.getParameters().size()); validateParameterCount(annotatedMethod); for (AnnotatedParameter<X> annotatedParameter : annotatedMethod.getParameters()) { EnhancedAnnotatedParameter<?, X> parameter = EnhancedAnnotatedParameterImpl.of(annotatedParameter, this, classTransformer); parameters.add(parameter); } this.parameters = immutableListView(parameters); String propertyName = Reflections.getPropertyName(getDelegate()); if (propertyName == null) { this.propertyName = getName(); } else { this.propertyName = propertyName; } this.signature = new MethodSignatureImpl(this); }
/** * Constructor * <p/> * Initializes the superclass with the built annotation map * * @param annotationType The annotation type */ protected EnhancedAnnotationImpl(SlimAnnotatedType<T> annotatedType, Map<Class<? extends Annotation>, Annotation> annotationMap, Map<Class<? extends Annotation>, Annotation> declaredAnnotationMap, ClassTransformer classTransformer) { super(annotatedType, annotationMap, declaredAnnotationMap, classTransformer); this.clazz = annotatedType.getJavaClass(); members = new HashSet<EnhancedAnnotatedMethod<?, ?>>(); annotatedMembers = SetMultimap.newSetMultimap(); for (AnnotatedMethod<? super T> annotatedMethod : annotatedType.getMethods()) { EnhancedAnnotatedMethod<?, ? super T> enhancedAnnotatedMethod = EnhancedAnnotatedMethodImpl.of(annotatedMethod, this, classTransformer); members.add(enhancedAnnotatedMethod); for (Annotation annotation : enhancedAnnotatedMethod.getAnnotations()) { annotatedMembers.put(annotation.annotationType(), enhancedAnnotatedMethod); } } }
public boolean isEquivalent(Method method) { return this.getDeclaringType().isEquivalent(method.getDeclaringClass()) && this.getName().equals(method.getName()) && Arrays.equals(this.getParameterTypesAsArray(), method.getParameterTypes()); }
public boolean isGeneric() { return getJavaMember().getTypeParameters().length > 0; }
ArrayList<EnhancedAnnotatedField<?, ? super T>> declaredFieldsTemp = new ArrayList<EnhancedAnnotatedField<?, ? super T>>(); Class<T> javaClass = annotatedType.getJavaClass(); if ((superclass != null) && (superclass.getJavaClass() != Object.class)) { fieldsTemp = Sets.union(fieldsTemp, Reflections.<Set<EnhancedAnnotatedField<?, ? super T>>>cast(superclass.getFields())); if (method.getJavaMember().getDeclaringClass().equals(javaClass)) { EnhancedAnnotatedMethod<?, ? super T> weldMethod = EnhancedAnnotatedMethodImpl.of(method, this, classTransformer); declaredMethodsTemp.add(weldMethod); for (Annotation annotation : weldMethod.getAnnotations()) { declaredAnnotatedMethods.put(annotation.annotationType(), weldMethod); if (weldMethod.getEnhancedParameters(annotationType).size() > 0) { declaredMethodsByAnnotatedParameters.put(annotationType, weldMethod); for (Class<?> interfaceClazz : Reflections.getInterfaceClosure(javaClass)) { EnhancedAnnotatedMethod<?, ? super T> enhancedMethod = EnhancedAnnotatedMethodImpl.of(method, this, classTransformer); methodsTemp.add(enhancedMethod); if (method.getJavaMember().getDeclaringClass().equals(javaClass)) { declaredMethodsTemp.add(enhancedMethod); this.declaredMethodsByAnnotatedParameters = Multimaps.unmodifiableMultimap(declaredMethodsByAnnotatedParameters); declaredMetaAnnotationMap.put(declaredAnnotation.annotationType(), declaredAnnotation);
public static <T, X, Y extends X> EnhancedAnnotatedMethodImpl<T, X> of(AnnotatedMethod<X> annotatedMethod, EnhancedAnnotatedType<Y> declaringClass, ClassTransformer classTransformer) { EnhancedAnnotatedType<X> downcastDeclaringType = Reflections.cast(declaringClass); return new EnhancedAnnotatedMethodImpl<T, X>(annotatedMethod, buildAnnotationMap(annotatedMethod.getAnnotations()), buildAnnotationMap(annotatedMethod.getAnnotations()), downcastDeclaringType, classTransformer); }
/** * Constructor * <p/> * Initializes the superclass with the built annotation map, sets the method * and declaring class abstraction and detects the actual type arguments * * @param method The underlying method * @param declaringClass The declaring class abstraction */ private EnhancedAnnotatedMethodImpl(AnnotatedMethod<X> annotatedMethod, Map<Class<? extends Annotation>, Annotation> annotationMap, Map<Class<? extends Annotation>, Annotation> declaredAnnotationMap, EnhancedAnnotatedType<X> declaringClass, ClassTransformer classTransformer) { super(annotatedMethod, annotationMap, declaredAnnotationMap, classTransformer, declaringClass); this.slim = annotatedMethod; ArrayList<EnhancedAnnotatedParameter<?, X>> parameters = new ArrayList<EnhancedAnnotatedParameter<?, X>>(annotatedMethod.getParameters().size()); validateParameterCount(annotatedMethod); for (AnnotatedParameter<X> annotatedParameter : annotatedMethod.getParameters()) { EnhancedAnnotatedParameter<?, X> parameter = EnhancedAnnotatedParameterImpl.of(annotatedParameter, this, classTransformer); parameters.add(parameter); } this.parameters = immutableListView(parameters); String propertyName = Reflections.getPropertyName(getDelegate()); if (propertyName == null) { this.propertyName = getName(); } else { this.propertyName = propertyName; } this.signature = new MethodSignatureImpl(this); }
/** * Constructor * <p/> * Initializes the superclass with the built annotation map * * @param annotationType The annotation type */ protected EnhancedAnnotationImpl(SlimAnnotatedType<T> annotatedType, Map<Class<? extends Annotation>, Annotation> annotationMap, Map<Class<? extends Annotation>, Annotation> declaredAnnotationMap, ClassTransformer classTransformer) { super(annotatedType, annotationMap, declaredAnnotationMap, classTransformer); this.clazz = annotatedType.getJavaClass(); members = new HashSet<EnhancedAnnotatedMethod<?, ?>>(); annotatedMembers = SetMultimap.newSetMultimap(); for (AnnotatedMethod<? super T> annotatedMethod : annotatedType.getMethods()) { EnhancedAnnotatedMethod<?, ? super T> enhancedAnnotatedMethod = EnhancedAnnotatedMethodImpl.of(annotatedMethod, this, classTransformer); members.add(enhancedAnnotatedMethod); for (Annotation annotation : enhancedAnnotatedMethod.getAnnotations()) { annotatedMembers.put(annotation.annotationType(), enhancedAnnotatedMethod); } } }
public boolean isEquivalent(Method method) { return this.getDeclaringType().isEquivalent(method.getDeclaringClass()) && this.getName().equals(method.getName()) && Arrays.equals(this.getParameterTypesAsArray(), method.getParameterTypes()); }