Package org.springframework.aot.hint

# Interface TypeReference

All Superinterfaces:
  `Comparable<TypeReference>`

All Known Implementing Classes:
  `AbstractTypeReference`, `GeneratedTypeReference`

public interface TypeReference extends Comparable<TypeReference>
Type abstraction that can be used to refer to types that are not available as a `Class` yet.

Since:
  6.0
Author:
  Stephane Nicoll, Sebastien Deleuze

## Method Summary

Modifier and Type
Method
Description
`String`
`getCanonicalName()`
Return the canonical name of this type reference.
`TypeReference`
`getEnclosingType()`
Return the enclosing type reference, or `null` if this type reference does not have an enclosing type.
`String`
`getName()`
Return the fully qualified name of this type reference.
`String`
`getPackageName()`
Return the package name of this type.
`String`
`getSimpleName()`
Return the simple name of this type reference.
`static List<TypeReference>`
`listOf(Class<?>... types)`
Create a list of `type references` mapped by the specified types.
`static TypeReference`
`of(Class<?> type)`
Create an instance based on the specified type.
`static TypeReference`
`of(String className)`
Create an instance based on the specified class name.

### Methods inherited from interface java.lang.Comparable

`compareTo`

## Method Details

### getName

String getName()
Return the fully qualified name of this type reference.

Returns:
  the reflection target name

### getCanonicalName

String getCanonicalName()
Return the canonical name of this type reference.

Returns:
  the canonical name

### getPackageName

String getPackageName()
Return the package name of this type.

Returns:
  the package name

### getSimpleName

String getSimpleName()
Return the simple name of this type reference.

Returns:
  the simple name

### getEnclosingType

@Nullable TypeReference getEnclosingType()
Return the enclosing type reference, or `null` if this type reference does not have an enclosing type.

Returns:
  the enclosing type, if any

### of

static TypeReference of(Class<?> type)
Create an instance based on the specified type.

Parameters:
  `type` - the type to wrap
Returns:
  a type reference for the specified type
Throws:
  `IllegalArgumentException` - if the specified type canonical name is `null`

### of

static TypeReference of(String className)
Create an instance based on the specified class name. The format of the class name must follow Class.getName(), in particular inner classes should be separated by a `$`.

Parameters:
  `className` - the class name of the type to wrap
Returns:
  a type reference for the specified class name

### listOf

static List<TypeReference> listOf(Class<?>... types)
Create a list of `type references` mapped by the specified types.

Parameters:
  `types` - the types to map
Returns:
  a list of type references