Package oracle.dbtools.plugin.api.types
Interface TypeQualifier<T>
-
- Type Parameters:
T
- The type of the service
public interface TypeQualifier<T>
Qualifies the specific type of a service to be discovered viaInstanceLocator
. Note that whilst JSR-330 supports the notion of arbitraryQualifier
s, this framework only supports the use of theNamed
qualifier.- Since:
- 19.3.0
- Author:
- cdivilly
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
TypeQualifier.Builder<T>
BuildTypeQualifier
instancesstatic class
TypeQualifier.MatchingMode
Determines how theTypeQualifier
matches types
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description static <T> TypeQualifier<T>
any(java.lang.Class<T> type)
Matches anyTypeQualifier
of the specified type, ignoring anyQualifier
s on the typejava.lang.String
declaration()
Provides the source code for thisTypeQualifier
boolean
equals(java.lang.Object obj)
static <T> TypeQualifier<T>
from(java.lang.Class<T> type, java.lang.annotation.Annotation... qualifiers)
Deprecated.usenamed(Class, String)
,any(Class)
orprovides(Class)
to more accurately identify theTypeQualifier
static <T> TypeQualifier<T>
from(java.lang.Class<T> type, java.lang.Iterable<? extends java.lang.annotation.Annotation> qualifiers)
Deprecated.usenamed(Class, String)
,any(Class)
orprovides(Class)
to more accurately identify theTypeQualifier
int
hashCode()
boolean
isEmpty()
Returns true if the qualifier has no annotation qualifiers, false otherwiseboolean
matches(TypeQualifier<?> other)
Determines if thisTypeQualifier
is a match for the specifiedTypeQualifier
boolean
matches(TypeReflection<?> type)
Determines if thisTypeQualifier
is a match for the specified typeTypeQualifier.MatchingMode
matchingMode()
Indicates how types are matchedjava.lang.String
name()
Returns the name constraint of thisTypeQualifier
if any.static <T> TypeQualifier<T>
named(java.lang.Class<T> type, java.lang.String name)
Construct aTypeQualifier
for the specified type and namedefault TypeQualifier<?>
normalize()
Normalize a potentially primitive type (e.g int.class) to it's boxed equivalent (e.g.static <T> TypeQualifier<T>
provides(java.lang.Class<T> type)
Represents a provider of the specified servicejava.lang.String
toString()
java.lang.Class<T>
type()
The type of the instance to findstatic <T> TypeQualifier<T>
type(java.lang.Class<T> type)
Selects the specified concrete type<E> TypeQualifier<E>
withType(java.lang.Class<E> type)
Override thisTypeQualifier
to produce a new instance that uses the specified type
-
-
-
Method Detail
-
declaration
java.lang.String declaration()
Provides the source code for thisTypeQualifier
- Returns:
- Text representing how this qualifier would be instantiated in source code
-
equals
boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
isEmpty
boolean isEmpty()
Returns true if the qualifier has no annotation qualifiers, false otherwise- Returns:
- true if the qualifier only denotes a type, i.e. has zero
Qualifier
annotations, false otherwise
-
matches
boolean matches(TypeQualifier<?> other)
Determines if thisTypeQualifier
is a match for the specifiedTypeQualifier
- Parameters:
other
- The qualifier to test against- Returns:
- true if there is a match, false otherwise
-
matches
boolean matches(TypeReflection<?> type)
Determines if thisTypeQualifier
is a match for the specified type- Parameters:
type
- The type to test again- Returns:
- true if the qualifier matches, false otherwise
-
matchingMode
TypeQualifier.MatchingMode matchingMode()
Indicates how types are matched- Returns:
TypeQualifier.MatchingMode
instance
-
name
java.lang.String name()
Returns the name constraint of thisTypeQualifier
if any.- Returns:
- Name constraint, or null if this qualifier does not have a
Named
constraint
-
withType
<E> TypeQualifier<E> withType(java.lang.Class<E> type)
Override thisTypeQualifier
to produce a new instance that uses the specified type- Type Parameters:
E
- The overidden type of the qualifier- Parameters:
type
- The new type- Returns:
TypeQualifier
instance
-
toString
java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
type
java.lang.Class<T> type()
The type of the instance to find- Returns:
- The type to find
-
any
static <T> TypeQualifier<T> any(java.lang.Class<T> type)
Matches anyTypeQualifier
of the specified type, ignoring anyQualifier
s on the type- Type Parameters:
T
- The type of the service- Parameters:
type
- The type of the service- Returns:
TypeQualifier
instance
-
from
@Deprecated static <T> TypeQualifier<T> from(java.lang.Class<T> type, java.lang.annotation.Annotation... qualifiers)
Deprecated.usenamed(Class, String)
,any(Class)
orprovides(Class)
to more accurately identify theTypeQualifier
Construct anTypeQualifier
from the specifiedAnnotations
. Note only theNamed
qualifier annotation is considered. ArbitraryQualifier
annotations are not supported as it is not possible to optimize their use for compile time dependency injection- Type Parameters:
T
- The type of the service- Parameters:
type
- The Type of the servicequalifiers
- The set of annotations to examine- Returns:
TypeQualifier
instance
-
from
@Deprecated static <T> TypeQualifier<T> from(java.lang.Class<T> type, java.lang.Iterable<? extends java.lang.annotation.Annotation> qualifiers)
Deprecated.usenamed(Class, String)
,any(Class)
orprovides(Class)
to more accurately identify theTypeQualifier
Construct anTypeQualifier
from the specifiedAnnotations
. Note only theNamed
qualifier annotation is considered. ArbitraryQualifier
annotations are not supported as it is not possible to optimize their use for compile time dependency injection- Type Parameters:
T
- The type of the service- Parameters:
type
- The Type of the servicequalifiers
- The set of annotations to examine- Returns:
TypeQualifier
instance
-
named
static <T> TypeQualifier<T> named(java.lang.Class<T> type, java.lang.String name)
Construct aTypeQualifier
for the specified type and name- Type Parameters:
T
- The type of the service- Parameters:
type
- The type of the servicename
- TheNamed
qualifier bound to the service- Returns:
TypeQualifier
instance
-
provides
static <T> TypeQualifier<T> provides(java.lang.Class<T> type)
Represents a provider of the specified service- Type Parameters:
T
- The type of the service- Parameters:
type
- The type of the service- Returns:
TypeQualifier
instance
-
type
static <T> TypeQualifier<T> type(java.lang.Class<T> type)
Selects the specified concrete type- Type Parameters:
T
- The type of the service- Parameters:
type
- The exact type to select- Returns:
TypeQualifier
instance
-
normalize
default TypeQualifier<?> normalize()
Normalize a potentially primitive type (e.g int.class) to it's boxed equivalent (e.g. Integer.class).- Returns:
- Self, unless this qualifier uses a primitive type, it's boxed equivalent
-
-