Package org.int4.dirk.core.definition
Interface Binding
-
public interface BindingBindings represent targets where values can be injected into an instance. This can be a field or one of the parameters of a method or constructor.Target
The target of a binding is determined by theAccessibleObjectand the givenParameter, it can be:- A constructor. The parameter indicates which constructor parameter is the target.
- A method. The parameter indicates which method parameter is the target.
- A field. Parameter is
null. - An owner class. In order to access non-static methods and fields the owner class is required as a binding. Both the parameter and the accessible object are
nullin this case.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.lang.reflect.AccessibleObjectgetAccessibleObject()Returns the targetAccessibleObjectfor the binding.default java.lang.reflect.AnnotatedElementgetAnnotatedElement()Returns the associatedAnnotatedElementfor this binding.java.lang.reflect.ParametergetParameter()Returns theParameterwhen theAccessibleObjectis a constructor or a method.java.util.Set<java.lang.annotation.Annotation>getQualifiers()Returns the qualifiers on the injection target.java.lang.reflect.TypegetType()Returns theTypeof the injection target.booleanisOptional()Returns whether this target acceptsnullas an injection value.
-
-
-
Method Detail
-
getType
java.lang.reflect.Type getType()
Returns theTypeof the injection target.- Returns:
- the
Typeof the injection target, nevernull
-
getQualifiers
java.util.Set<java.lang.annotation.Annotation> getQualifiers()
Returns the qualifiers on the injection target.- Returns:
- a set of qualifier annotations, never
nulland never containsnull
-
isOptional
boolean isOptional()
Returns whether this target acceptsnullas an injection value. Normallynullis rejected withUnsatisfiedResolutionException, but optional targets treatnulldifferently. If the target is a method or constructor parameters,nullis simply provided, leaving it up to the receiver to deal with thenull. For fields, the injection is skipped leaving its default value intact.- Returns:
trueif the target is optional, otherwisefalse
-
getAccessibleObject
java.lang.reflect.AccessibleObject getAccessibleObject()
Returns the targetAccessibleObjectfor the binding. This isnullwhen the binding refers to the declaring class which is required to access a non-static field or method.- Returns:
- the target @link AccessibleObject} for the binding, can be
null
-
getParameter
java.lang.reflect.Parameter getParameter()
Returns theParameterwhen theAccessibleObjectis a constructor or a method. Returnsnullfor fields.- Returns:
- a
Parameter, can benull
-
getAnnotatedElement
default java.lang.reflect.AnnotatedElement getAnnotatedElement()
Returns the associatedAnnotatedElementfor this binding. This isnullfor owner bindings.- Returns:
- the associated
AnnotatedElementfor this binding, can benull
-
-