org.springframework.beans.factory

Class InjectionPoint

  • java.lang.Object
    • org.springframework.beans.factory.InjectionPoint
    • Constructor Summary

      Constructors 
      Modifier Constructor and Description
      protected InjectionPoint()
      Just available for serialization purposes in subclasses.
        InjectionPoint(java.lang.reflect.Field field)
      Create an injection point descriptor for a field.
      protected InjectionPoint(InjectionPoint original)
      Copy constructor.
        InjectionPoint(MethodParameter methodParameter)
      Create an injection point descriptor for a method or constructor parameter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean equals(java.lang.Object other) 
      java.lang.reflect.AnnotatedElement getAnnotatedElement()
      Return the wrapped annotated element.
      <A extends java.lang.annotation.Annotation>
      A
      getAnnotation(java.lang.Class<A> annotationType)
      Retrieve a field/parameter annotation of the given type, if any.
      java.lang.annotation.Annotation[] getAnnotations()
      Obtain the annotations associated with the wrapped field or method/constructor parameter.
      java.lang.Class<?> getDeclaredType()
      Return the type declared by the underlying field or method/constructor parameter, indicating the injection type.
      java.lang.reflect.Field getField()
      Return the wrapped Field, if any.
      java.lang.reflect.Member getMember()
      Returns the wrapped member, containing the injection point.
      MethodParameter getMethodParameter()
      Return the wrapped MethodParameter, if any.
      int hashCode() 
      protected MethodParameter obtainMethodParameter()
      Return the wrapped MethodParameter, assuming it is present.
      java.lang.String toString() 
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • InjectionPoint

        public InjectionPoint(MethodParameter methodParameter)
        Create an injection point descriptor for a method or constructor parameter.
        Parameters:
        methodParameter - the MethodParameter to wrap
      • InjectionPoint

        public InjectionPoint(java.lang.reflect.Field field)
        Create an injection point descriptor for a field.
        Parameters:
        field - the field to wrap
      • InjectionPoint

        protected InjectionPoint(InjectionPoint original)
        Copy constructor.
        Parameters:
        original - the original descriptor to create a copy from
      • InjectionPoint

        protected InjectionPoint()
        Just available for serialization purposes in subclasses.
    • Method Detail

      • getMethodParameter

        @Nullable
        public MethodParameter getMethodParameter()
        Return the wrapped MethodParameter, if any.

        Note: Either MethodParameter or Field is available.

        Returns:
        the MethodParameter, or null if none
      • getField

        @Nullable
        public java.lang.reflect.Field getField()
        Return the wrapped Field, if any.

        Note: Either MethodParameter or Field is available.

        Returns:
        the Field, or null if none
      • obtainMethodParameter

        protected final MethodParameter obtainMethodParameter()
        Return the wrapped MethodParameter, assuming it is present.
        Returns:
        the MethodParameter (never null)
        Throws:
        java.lang.IllegalStateException - if no MethodParameter is available
        Since:
        5.0
      • getAnnotations

        public java.lang.annotation.Annotation[] getAnnotations()
        Obtain the annotations associated with the wrapped field or method/constructor parameter.
      • getAnnotation

        @Nullable
        public <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<A> annotationType)
        Retrieve a field/parameter annotation of the given type, if any.
        Parameters:
        annotationType - the annotation type to retrieve
        Returns:
        the annotation instance, or null if none found
        Since:
        4.3.9
      • getDeclaredType

        public java.lang.Class<?> getDeclaredType()
        Return the type declared by the underlying field or method/constructor parameter, indicating the injection type.
      • getMember

        public java.lang.reflect.Member getMember()
        Returns the wrapped member, containing the injection point.
        Returns:
        the Field / Method / Constructor as Member
      • getAnnotatedElement

        public java.lang.reflect.AnnotatedElement getAnnotatedElement()
        Return the wrapped annotated element.

        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 getAnnotations() to obtain parameter-level annotations in such a scenario, transparently with corresponding field annotations.

        Returns:
        the Field / Method / Constructor as AnnotatedElement
      • equals

        public boolean equals(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object