public final class AnnotatedTypes
extends java.lang.Object
AnnotatedWildcardTypes
,
AnnotatedParameterizedTypes
, and AnnotatedArrayTypes
.Modifier and Type | Class and Description |
---|---|
static interface |
AnnotatedTypes.AnnotatedTypeInternal
An internal interface to add some extra functionality onto annotated types.
|
static class |
AnnotatedTypes.AnnotatedTypeParser
A parser for
AnnotatedType s, and various related types. |
Modifier and Type | Method and Description |
---|---|
static java.util.List<java.lang.reflect.AnnotatedType> |
annotated(java.util.Collection<? extends java.lang.reflect.Type> types)
Transform a collection of
Type s into a new list of
AnnotatedType s, according to the behaviour of
annotated(Type) applied to element of the collection. |
static java.lang.reflect.AnnotatedType[] |
annotated(java.lang.reflect.Type... types)
Transform an array of
Type s into a new array of
AnnotatedType s, according to the behaviour of
annotated(Type) applied to element of the array. |
static java.lang.reflect.AnnotatedType |
annotated(java.lang.reflect.Type type)
Derive a representation of a given type according the appropriate class of
AnnotatedType . |
static java.lang.reflect.AnnotatedType |
annotated(java.lang.reflect.Type type,
java.lang.annotation.Annotation... annotations)
Derive a representation of a given type according the appropriate class of
AnnotatedType , and with the given annotations. |
static java.lang.reflect.AnnotatedType |
annotated(java.lang.reflect.Type type,
java.util.Collection<java.lang.annotation.Annotation> annotations)
Derive a representation of a given type according the appropriate class of
AnnotatedType , and with the given annotations. |
protected static AnnotatedTypes.AnnotatedTypeInternal[] |
annotatedImpl(Isomorphism isomorphism,
java.lang.reflect.Type... types) |
protected static AnnotatedTypes.AnnotatedTypeInternal |
annotatedImpl(Isomorphism isomorphism,
java.lang.reflect.Type type) |
protected static AnnotatedTypes.AnnotatedTypeInternal |
annotatedImpl(Isomorphism isomorphism,
java.lang.reflect.Type type,
java.util.Collection<java.lang.annotation.Annotation> annotations) |
static boolean |
equals(java.lang.reflect.AnnotatedType first,
java.lang.reflect.AnnotatedType second)
A correct equality implementation for annotated types, since the Java
specification does not require implementors to provide this.
|
static java.lang.reflect.AnnotatedType |
fromString(java.lang.String typeString)
Create an AnnotatedType instance from a parsed String.
|
static java.lang.reflect.AnnotatedType |
fromString(java.lang.String typeString,
Imports imports)
Create an AnnotatedType instance from a parsed String.
|
static AnnotatedTypes.AnnotatedTypeParser |
getParser()
Get the default annotated type parser.
|
static AnnotatedTypes.AnnotatedTypeParser |
getParser(Imports imports)
Get an annotated type parser with knowledge of the given imports.
|
static int |
hashCode(java.lang.reflect.AnnotatedType annotatedType)
A correct hash code implementation for annotated types, since the Java
specification does not require implementors to provide this.
|
static java.lang.String |
toString(java.lang.reflect.AnnotatedType annotatedType)
Give a canonical String representation of a given annotated type, which is
intended to be more easily human-readable than implementations of
Object.toString() for certain implementations of Type . |
static java.lang.String |
toString(java.lang.reflect.AnnotatedType annotatedType,
Imports imports)
Give a canonical String representation of a given annotated type, which is
intended to be more easily human-readable than implementations of
Object.toString() for certain implementations of Type . |
static java.lang.reflect.AnnotatedType |
wrap(java.lang.reflect.AnnotatedType type)
Re-implement the given annotated type with correctly working
Object.hashCode() and Object.equals(Object) implementations. |
protected static AnnotatedTypes.AnnotatedTypeInternal |
wrapImpl(java.lang.reflect.AnnotatedType type) |
protected static AnnotatedTypes.AnnotatedTypeInternal[] |
wrapImpl(Isomorphism isomorphism,
java.lang.reflect.AnnotatedType... type) |
protected static AnnotatedTypes.AnnotatedTypeInternal |
wrapImpl(Isomorphism isomorphism,
java.lang.reflect.AnnotatedType type) |
public static int hashCode(java.lang.reflect.AnnotatedType annotatedType)
annotatedType
- The annotated type whose hash code we wish to determine.public static boolean equals(java.lang.reflect.AnnotatedType first, java.lang.reflect.AnnotatedType second)
first
- The first of the two annotated types whose equality we wish to
determine.second
- The second of the two annotated types whose equality we wish to
determine.public static java.lang.reflect.AnnotatedType[] annotated(java.lang.reflect.Type... types)
Type
s into a new array of
AnnotatedType
s, according to the behaviour of
annotated(Type)
applied to element of the array.types
- The array of types to transform.AnnotatedType
instances.public static java.util.List<java.lang.reflect.AnnotatedType> annotated(java.util.Collection<? extends java.lang.reflect.Type> types)
Type
s into a new list of
AnnotatedType
s, according to the behaviour of
annotated(Type)
applied to element of the collection.types
- The collection of types to transform.AnnotatedType
instances.public static java.lang.reflect.AnnotatedType annotated(java.lang.reflect.Type type)
AnnotatedType
.type
- The type for which we wish to derive the annotated form.AnnotatedType
instance of the appropriate class over the
given type containing no annotations.public static java.lang.reflect.AnnotatedType annotated(java.lang.reflect.Type type, java.lang.annotation.Annotation... annotations)
AnnotatedType
, and with the given annotations.type
- The type for which we wish to derive the annotated form.annotations
- The annotations we wish for the annotated type to contain.AnnotatedType
instance of the appropriate class over the
given type containing the given annotations.public static java.lang.reflect.AnnotatedType annotated(java.lang.reflect.Type type, java.util.Collection<java.lang.annotation.Annotation> annotations)
AnnotatedType
, and with the given annotations.type
- The type for which we wish to derive the annotated form.annotations
- The annotations we wish for the annotated type to contain.AnnotatedType
instance of the appropriate class over the
given type containing the given annotations.protected static AnnotatedTypes.AnnotatedTypeInternal[] annotatedImpl(Isomorphism isomorphism, java.lang.reflect.Type... types)
protected static AnnotatedTypes.AnnotatedTypeInternal annotatedImpl(Isomorphism isomorphism, java.lang.reflect.Type type)
protected static AnnotatedTypes.AnnotatedTypeInternal annotatedImpl(Isomorphism isomorphism, java.lang.reflect.Type type, java.util.Collection<java.lang.annotation.Annotation> annotations)
protected static AnnotatedTypes.AnnotatedTypeInternal[] wrapImpl(Isomorphism isomorphism, java.lang.reflect.AnnotatedType... type)
protected static AnnotatedTypes.AnnotatedTypeInternal wrapImpl(java.lang.reflect.AnnotatedType type)
protected static AnnotatedTypes.AnnotatedTypeInternal wrapImpl(Isomorphism isomorphism, java.lang.reflect.AnnotatedType type)
public static java.lang.reflect.AnnotatedType wrap(java.lang.reflect.AnnotatedType type)
Object.hashCode()
and Object.equals(Object)
implementations.type
- The annotated type we wish to re-implement.AnnotatedType
instance equal to the given annotated type.public static java.lang.String toString(java.lang.reflect.AnnotatedType annotatedType, Imports imports)
Object.toString()
for certain implementations of Type
.
Provided class and package imports allow the names of some classes to be
output without full package qualification.annotatedType
- The type of which we wish to determine a string representation.imports
- Classes and packages for which full package qualification may be
omitted from output.public static java.lang.String toString(java.lang.reflect.AnnotatedType annotatedType)
Object.toString()
for certain implementations of Type
.annotatedType
- The type of which we wish to determine a string representation.public static java.lang.reflect.AnnotatedType fromString(java.lang.String typeString)
typeString
- The String to parse.public static java.lang.reflect.AnnotatedType fromString(java.lang.String typeString, Imports imports)
typeString
- The String to parse.imports
- Classes and packages for which full package qualification may be
omitted from input.public static AnnotatedTypes.AnnotatedTypeParser getParser()
public static AnnotatedTypes.AnnotatedTypeParser getParser(Imports imports)
imports
- A list of imports the annotated type parser should be aware of