@Beta
public interface TypeReferenceProvider
TypeReference
instances.Modifier and Type | Method and Description |
---|---|
TypeReference |
getAnyType()
The any type is the type of the null pointer and has no concrete
representation in Java.
|
TypeReference |
getList(TypeReference param) |
TypeReference |
getObject() |
TypeReference |
getPrimitiveBoolean() |
TypeReference |
getPrimitiveByte() |
TypeReference |
getPrimitiveChar() |
TypeReference |
getPrimitiveDouble() |
TypeReference |
getPrimitiveFloat() |
TypeReference |
getPrimitiveInt() |
TypeReference |
getPrimitiveLong() |
TypeReference |
getPrimitiveShort() |
TypeReference |
getPrimitiveVoid() |
TypeReference |
getSet(TypeReference param) |
TypeReference |
getString() |
TypeReference |
newArrayTypeReference(TypeReference componentType)
Creates a new array type reference using the given component type.
|
TypeReference |
newSelfTypeReference(Type typeDeclaration)
Returns a new self type reference for the given typeDeclaration, e.g. if you have a class like
class Foo<T> {}
And you want to add a method that returns the instance itself, you would use the self type as the method's return type.
|
TypeReference |
newTypeReference(java.lang.Class<?> clazz,
TypeReference... typeArguments)
Creates a new type reference for the given
Class and the type arguments. |
TypeReference |
newTypeReference(java.lang.String typeName,
TypeReference... typeArguments)
Creates a new type reference for the given name and the given type arguments.
|
TypeReference |
newTypeReference(Type typeDeclaration,
TypeReference... typeArguments)
Creates a new type reference for the given typeDeclaration and the type arguments.
|
TypeReference |
newWildcardTypeReference() |
TypeReference |
newWildcardTypeReference(TypeReference upperBound) |
TypeReference |
newWildcardTypeReferenceWithLowerBound(TypeReference lowerBound) |
TypeReference newArrayTypeReference(TypeReference componentType)
componentType
- the component type of the array type referenceTypeReference newTypeReference(java.lang.String typeName, TypeReference... typeArguments)
typeName
- the name of the type to point totypeArguments
- the type argumentsTypeReference
pointing to the type with given name, or null
if no such type could be found.TypeReference newTypeReference(Type typeDeclaration, TypeReference... typeArguments)
typeDeclaration
- the type to point totypeArguments
- the type argumentsTypeReference
pointing to the given type.TypeReference newSelfTypeReference(Type typeDeclaration)
class Foo<T> {}And you want to add a method that returns the instance itself, you would use the self type as the method's return type.
class Foo<T> { def Foo<T> mySelf() { this } }In contrast,
newTypeReference(Type, TypeReference...)
without any arguments would return the raw type only and would result in code with warnings:
class Foo<T> { def Foo mySelf() { this } }
typeDeclaration
- the raw type for the newly produced referenceTypeReference newTypeReference(java.lang.Class<?> clazz, TypeReference... typeArguments)
Class
and the type arguments.clazz
- the clazz to point totypeArguments
- the type argumentsTypeReference
pointing to the given type or null
if the type is not on the class path of the compiled project.TypeReference newWildcardTypeReference()
Object
TypeReference newWildcardTypeReference(TypeReference upperBound)
upperBound
- the upper bound of the wildcard typeTypeReference newWildcardTypeReferenceWithLowerBound(TypeReference lowerBound)
lowerBound
- the lower bound of the wildcard typeTypeReference getObject()
Object
TypeReference getString()
String
TypeReference getList(TypeReference param)
param
- the type argument for the type referenceList
with the given type argument.TypeReference getSet(TypeReference param)
param
- the type argument for the type referenceSet
with the given type argument.TypeReference getAnyType()
TypeReference getPrimitiveVoid()
TypeReference getPrimitiveBoolean()
TypeReference getPrimitiveShort()
TypeReference getPrimitiveInt()
TypeReference getPrimitiveLong()
TypeReference getPrimitiveFloat()
TypeReference getPrimitiveDouble()
TypeReference getPrimitiveChar()
TypeReference getPrimitiveByte()