T
- The type of the servicepublic interface TypeQualifier<T>
InstanceLocator
. Note that whilst JSR-330 supports the notion of arbitrary Qualifier
s, this framework only supports the use of the Named
qualifier.Modifier and Type | Interface and Description |
---|---|
static interface |
TypeQualifier.Builder<T>
Build
TypeQualifier instances |
static class |
TypeQualifier.MatchingMode
Determines how the
TypeQualifier matches types |
Modifier and Type | Method and Description |
---|---|
static <T> TypeQualifier<T> |
any(Class<T> type)
Matches any
TypeQualifier of the specified type, ignoring any Qualifier s on the type |
String |
declaration()
Provides the source code for this
TypeQualifier |
boolean |
equals(Object obj) |
static <T> TypeQualifier<T> |
from(Class<T> type, Annotation... qualifiers)
Deprecated.
use
named(Class, String) , any(Class) or provides(Class) to more accurately identify the TypeQualifier |
static <T> TypeQualifier<T> |
from(Class<T> type, Iterable<? extends Annotation> qualifiers)
Deprecated.
use
named(Class, String) , any(Class) or provides(Class) to more accurately identify the TypeQualifier |
int |
hashCode() |
boolean |
isEmpty()
Returns true if the qualifier has no annotation qualifiers, false otherwise
|
boolean |
matches(TypeQualifier<?> other)
Determines if this
TypeQualifier is a match for the specified TypeQualifier |
boolean |
matches(TypeReflection<?> type)
Determines if this
TypeQualifier is a match for the specified type |
TypeQualifier.MatchingMode |
matchingMode()
Indicates how types are matched
|
String |
name()
Returns the name constraint of this
TypeQualifier if any. |
static <T> TypeQualifier<T> |
named(Class<T> type, String name)
Construct a
TypeQualifier for the specified type and name |
default TypeQualifier<?> |
normalize()
Normalize a potentially primitive type (e.g int.class) to it's boxed equivalent (e.g.
|
static <T> TypeQualifier<T> |
provides(Class<T> type)
Represents a provider of the specified service
|
String |
toString() |
Class<T> |
type()
The type of the instance to find
|
static <T> TypeQualifier<T> |
type(Class<T> type)
Selects the specified concrete type
|
<E> TypeQualifier<E> |
withType(Class<E> type)
Override this
TypeQualifier to produce a new instance that uses the specified type |
String declaration()
TypeQualifier
boolean isEmpty()
Qualifier
annotations, false otherwiseboolean matches(TypeQualifier<?> other)
TypeQualifier
is a match for the specified TypeQualifier
other
- The qualifier to test againstboolean matches(TypeReflection<?> type)
TypeQualifier
is a match for the specified typetype
- The type to test againTypeQualifier.MatchingMode matchingMode()
TypeQualifier.MatchingMode
instanceString name()
TypeQualifier
if any.Named
constraint<E> TypeQualifier<E> withType(Class<E> type)
TypeQualifier
to produce a new instance that uses the specified typeE
- The overidden type of the qualifiertype
- The new typeTypeQualifier
instancestatic <T> TypeQualifier<T> any(Class<T> type)
TypeQualifier
of the specified type, ignoring any Qualifier
s on the typeT
- The type of the servicetype
- The type of the serviceTypeQualifier
instance@Deprecated static <T> TypeQualifier<T> from(Class<T> type, Annotation... qualifiers)
named(Class, String)
, any(Class)
or provides(Class)
to more accurately identify the TypeQualifier
TypeQualifier
from the specified Annotations
. Note only the Named
qualifier annotation is considered. Arbitrary Qualifier
annotations are not supported as it is not possible to optimize their use for compile time dependency injectionT
- The type of the servicetype
- The Type of the servicequalifiers
- The set of annotations to examineTypeQualifier
instance@Deprecated static <T> TypeQualifier<T> from(Class<T> type, Iterable<? extends Annotation> qualifiers)
named(Class, String)
, any(Class)
or provides(Class)
to more accurately identify the TypeQualifier
TypeQualifier
from the specified Annotations
. Note only the Named
qualifier annotation is considered. Arbitrary Qualifier
annotations are not supported as it is not possible to optimize their use for compile time dependency injectionT
- The type of the servicetype
- The Type of the servicequalifiers
- The set of annotations to examineTypeQualifier
instancestatic <T> TypeQualifier<T> named(Class<T> type, String name)
TypeQualifier
for the specified type and nameT
- The type of the servicetype
- The type of the servicename
- The Named
qualifier bound to the serviceTypeQualifier
instancestatic <T> TypeQualifier<T> provides(Class<T> type)
T
- The type of the servicetype
- The type of the serviceTypeQualifier
instancestatic <T> TypeQualifier<T> type(Class<T> type)
T
- The type of the servicetype
- The exact type to selectTypeQualifier
instancedefault TypeQualifier<?> normalize()