/** * Return the type declared by the underlying field or method/constructor parameter, * indicating the injection type. */ public Class<?> getDeclaredType() { return (this.field != null ? this.field.getType() : obtainMethodParameter().getParameterType()); }
/** * Retrieve a field/parameter annotation of the given type, if any. * @param annotationType the annotation type to retrieve * @return the annotation instance, or {@code null} if none found * @since 4.3.9 */ @Nullable public <A extends Annotation> A getAnnotation(Class<A> annotationType) { return (this.field != null ? this.field.getAnnotation(annotationType) : obtainMethodParameter().getParameterAnnotation(annotationType)); }
/** * Returns the wrapped member, containing the injection point. * @return the Field / Method / Constructor as Member */ public Member getMember() { return (this.field != null ? this.field : obtainMethodParameter().getMember()); }
/** * Return the wrapped annotated element. * <p>Note: In case of a method/constructor parameter, this exposes * the annotations declared on the method or constructor itself * (i.e. at the method/constructor level, not at the parameter level). * Use {@link #getAnnotations()} to obtain parameter-level annotations in * such a scenario, transparently with corresponding field annotations. * @return the Field / Method / Constructor as AnnotatedElement */ public AnnotatedElement getAnnotatedElement() { return (this.field != null ? this.field : obtainMethodParameter().getAnnotatedElement()); }
/** * Return the type declared by the underlying field or method/constructor parameter, * indicating the injection type. */ public Class<?> getDeclaredType() { return (this.field != null ? this.field.getType() : obtainMethodParameter().getParameterType()); }
/** * Obtain the annotations associated with the wrapped field or method/constructor parameter. */ public Annotation[] getAnnotations() { if (this.field != null) { Annotation[] fieldAnnotations = this.fieldAnnotations; if (fieldAnnotations == null) { fieldAnnotations = this.field.getAnnotations(); this.fieldAnnotations = fieldAnnotations; } return fieldAnnotations; } else { return obtainMethodParameter().getParameterAnnotations(); } }
/** * Returns the wrapped member, containing the injection point. * @return the Field / Method / Constructor as Member */ public Member getMember() { return (this.field != null ? this.field : obtainMethodParameter().getMember()); }
/** * Return the wrapped annotated element. * <p>Note: In case of a method/constructor parameter, this exposes * the annotations declared on the method or constructor itself * (i.e. at the method/constructor level, not at the parameter level). * Use {@link #getAnnotations()} to obtain parameter-level annotations in * such a scenario, transparently with corresponding field annotations. * @return the Field / Method / Constructor as AnnotatedElement */ public AnnotatedElement getAnnotatedElement() { return (this.field != null ? this.field : obtainMethodParameter().getAnnotatedElement()); }
/** * Retrieve a field/parameter annotation of the given type, if any. * @param annotationType the annotation type to retrieve * @return the annotation instance, or {@code null} if none found * @since 4.3.9 */ @Nullable public <A extends Annotation> A getAnnotation(Class<A> annotationType) { return (this.field != null ? this.field.getAnnotation(annotationType) : obtainMethodParameter().getParameterAnnotation(annotationType)); }
/** * Obtain the annotations associated with the wrapped field or method/constructor parameter. */ public Annotation[] getAnnotations() { if (this.field != null) { Annotation[] fieldAnnotations = this.fieldAnnotations; if (fieldAnnotations == null) { fieldAnnotations = this.field.getAnnotations(); this.fieldAnnotations = fieldAnnotations; } return fieldAnnotations; } else { return obtainMethodParameter().getParameterAnnotations(); } }