Package org.jdbi.v3.core.qualifier
Class QualifiedType<T>
java.lang.Object
org.jdbi.v3.core.qualifier.QualifiedType<T>
- Type Parameters:
T
- the type that is qualified
A
Type
qualified by a set of qualifier annotations. Two qualified types are equal to each other
if their getType()
and getQualifiers()
properties are equal.-
Method Summary
Modifier and TypeMethodDescriptionboolean
flatMapType
(Function<Type, Optional<Type>> mapper) Apply the provided mapping function to the type, and if non-empty is returned, return anOptional<QualifiedType<?>>
with the returned type, and the same qualifiers as this instance.Returns a set of qualifying annotations.getType()
Returns the qualified type.int
hashCode()
boolean
hasQualifier
(Class<? extends Annotation> qualifier) Returns true if this type contains the given qualifier.Apply the provided mapping function to the type, and if non-empty is returned, return anOptional<QualifiedType<?>>
with the returned type, and the same qualifiers as this instance.static <T> QualifiedType<T>
Creates aQualifiedType<T>
for aClass<T>
with no qualifiers.static QualifiedType<?>
Creates a wildcardQualifiedType<?>
for aType
with no qualifiers.static <T> QualifiedType<T>
of
(GenericType<T> type) Creates aQualifiedType<T>
for aGenericType<T>
with no qualifiers.toString()
with
(Annotation... newQualifiers) Returns a QualifiedType that has the same type as this instance, but with only the given qualifiers.final QualifiedType<T>
with
(Class<? extends Annotation>... newQualifiers) Returns a QualifiedType that has the same type as this instance, but with only the given qualifiers.withAnnotationClasses
(Iterable<Class<? extends Annotation>> newQualifiers) Creates a QualifiedType with the same type as this instance and new qualifiers.withAnnotations
(Iterable<? extends Annotation> newQualifiers) Creates a QualifiedType with the same type as this instance and new qualifiers.
-
Method Details
-
of
Creates aQualifiedType<T>
for aClass<T>
with no qualifiers.- Parameters:
clazz
- the unqualified type- Returns:
- the unqualified QualifiedType
- See Also:
-
of
Creates a wildcardQualifiedType<?>
for aType
with no qualifiers.- Parameters:
type
- the unqualified type- Returns:
- the unqualified QualifiedType
- See Also:
-
of
Creates aQualifiedType<T>
for aGenericType<T>
with no qualifiers.- Parameters:
type
- the unqualified type- Returns:
- the unqualified QualifiedType
- See Also:
-
with
Returns a QualifiedType that has the same type as this instance, but with only the given qualifiers.- Parameters:
newQualifiers
- the qualifiers for the new qualified type.- Returns:
- the QualifiedType
-
with
Returns a QualifiedType that has the same type as this instance, but with only the given qualifiers.- Parameters:
newQualifiers
- the qualifiers for the new qualified type.- Returns:
- the QualifiedType
- Throws:
IllegalArgumentException
- if any of the given qualifier types have annotation attributes.
-
withAnnotations
Creates a QualifiedType with the same type as this instance and new qualifiers. Old qualifiers are discarded.- Parameters:
newQualifiers
- the qualifiers for the new qualified type.- Returns:
- a QualifiedType that has the same type as this instance, but with only the given qualifiers.
-
withAnnotationClasses
Creates a QualifiedType with the same type as this instance and new qualifiers. Old qualifiers are discarded.- Parameters:
newQualifiers
- the qualifiers for the new qualified type.- Returns:
- a QualifiedType that has the same type as this instance, but with only the given qualifiers.
-
getType
Returns the qualified type.- Returns:
- the type being qualified.
-
getQualifiers
Returns a set of qualifying annotations.- Returns:
- the type qualifiers.
-
mapType
Apply the provided mapping function to the type, and if non-empty is returned, return anOptional<QualifiedType<?>>
with the returned type, and the same qualifiers as this instance.- Parameters:
mapper
- a mapping function to apply to the type- Returns:
- an optional qualified type with the mapped type and the same qualifiers
-
flatMapType
Apply the provided mapping function to the type, and if non-empty is returned, return anOptional<QualifiedType<?>>
with the returned type, and the same qualifiers as this instance.- Parameters:
mapper
- a mapping function to apply to the type- Returns:
- an optional qualified type with the mapped type and the same qualifiers
-
hasQualifier
Returns true if this type contains the given qualifier.- Parameters:
qualifier
- qualifier to check for.- Returns:
- true if this instance contains the given qualifier.
-
equals
-
hashCode
public int hashCode() -
toString
-