Interface TypeReferenceProvider
-
- All Known Subinterfaces:
TransformationContext,ValidationContext
@Beta public interface TypeReferenceProviderProvides and createsTypeReferenceinstances.- Noimplement:
- This interface is not intended to be implemented by clients.
-
-
Method Summary
-
-
-
Method Detail
-
newArrayTypeReference
TypeReference newArrayTypeReference(TypeReference componentType)
Creates a new array type reference using the given component type. If the component type is itself an array this method adds a dimension.- Parameters:
componentType- the component type of the array type reference- Returns:
- an array type reference
-
newTypeReference
TypeReference newTypeReference(java.lang.String typeName, TypeReference... typeArguments)
Creates a new type reference for the given name and the given type arguments.- Parameters:
typeName- the name of the type to point totypeArguments- the type arguments- Returns:
- a
TypeReferencepointing to the type with given name, ornullif no such type could be found.
-
newTypeReference
TypeReference newTypeReference(Type typeDeclaration, TypeReference... typeArguments)
Creates a new type reference for the given typeDeclaration and the type arguments.- Parameters:
typeDeclaration- the type to point totypeArguments- the type arguments- Returns:
- a
TypeReferencepointing to the given type.
-
newSelfTypeReference
TypeReference newSelfTypeReference(Type typeDeclaration)
Returns a new self type reference for the given typeDeclaration, e.g. if you have a class likeclass 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 } }- Parameters:
typeDeclaration- the raw type for the newly produced reference- Returns:
- a reference to the given type declaration
- Since:
- 2.7
-
newTypeReference
TypeReference newTypeReference(java.lang.Class<?> clazz, TypeReference... typeArguments)
Creates a new type reference for the givenClassand the type arguments.- Parameters:
clazz- the clazz to point totypeArguments- the type arguments- Returns:
- a
TypeReferencepointing to the given type ornullif the type is not on the class path of the compiled project.
-
newWildcardTypeReference
TypeReference newWildcardTypeReference()
- Returns:
- a wildcard type references with upperBound
Object
-
newWildcardTypeReference
TypeReference newWildcardTypeReference(TypeReference upperBound)
- Parameters:
upperBound- the upper bound of the wildcard type- Returns:
- a wildcard type references with the given upperBound.
-
newWildcardTypeReferenceWithLowerBound
TypeReference newWildcardTypeReferenceWithLowerBound(TypeReference lowerBound)
- Parameters:
lowerBound- the lower bound of the wildcard type- Returns:
- a wildcard type references with the given lowerBound.
-
getObject
TypeReference getObject()
- Returns:
- a type reference pointing to
Object
-
getString
TypeReference getString()
- Returns:
- a type reference pointing to
String
-
getList
TypeReference getList(TypeReference param)
- Parameters:
param- the type argument for the type reference- Returns:
- a type reference for
Listwith the given type argument.
-
getSet
TypeReference getSet(TypeReference param)
- Parameters:
param- the type argument for the type reference- Returns:
- a type reference for
Setwith the given type argument.
-
getAnyType
TypeReference getAnyType()
The any type is the type of the null pointer and has no concrete representation in Java. It is assignable to every reference type.- Returns:
- a type reference representing the "any type".
-
getPrimitiveVoid
TypeReference getPrimitiveVoid()
- Returns:
- a type reference representing 'void'
-
getPrimitiveBoolean
TypeReference getPrimitiveBoolean()
- Returns:
- a type reference representing 'boolean'
-
getPrimitiveShort
TypeReference getPrimitiveShort()
- Returns:
- a type reference representing 'short'
-
getPrimitiveInt
TypeReference getPrimitiveInt()
- Returns:
- a type reference representing 'int'
-
getPrimitiveLong
TypeReference getPrimitiveLong()
- Returns:
- a type reference representing 'long'
-
getPrimitiveFloat
TypeReference getPrimitiveFloat()
- Returns:
- a type reference representing 'float'
-
getPrimitiveDouble
TypeReference getPrimitiveDouble()
- Returns:
- a type reference representing 'double'
-
getPrimitiveChar
TypeReference getPrimitiveChar()
- Returns:
- a type reference representing 'char'
-
getPrimitiveByte
TypeReference getPrimitiveByte()
- Returns:
- a type reference representing 'byte'
-
-