Class TypeNames

java.lang.Object
org.springframework.data.javapoet.TypeNames

public abstract class TypeNames extends Object
Collection of TypeName transformation utilities.

This class delivers some simple functionality that should be provided by the JavaPoet framework. It also provides easy-to-use methods to convert between types.

Mainly for internal use within the framework

Since:
4.0
Author:
Mark Paluch
  • Method Details

    • classNameOrWrapper

      public static org.springframework.javapoet.TypeName classNameOrWrapper(Class<?> type)
      Obtain a class name for the given type, resolving primitive wrappers as necessary.
      Parameters:
      type - the class to use.
      Returns:
      the corresponding TypeName.
    • classNameOrWrapper

      public static org.springframework.javapoet.TypeName classNameOrWrapper(ResolvableType resolvableType)
      Obtain a class name for the given ResolvableType, resolving primitive wrappers as necessary. Ideal to represent a type name used as Class value as generic parameters are not considered.
      Parameters:
      resolvableType - the resolvable type to use.
      Returns:
      the corresponding TypeName.
    • className

      public static org.springframework.javapoet.TypeName className(ResolvableType resolvableType)
      Obtain a TypeName for the given ResolvableType. Ideal to represent a type name used as Class value as generic parameters are not considered.
      Parameters:
      resolvableType - the resolvable type to use.
      Returns:
      the corresponding TypeName.
    • typeName

      public static org.springframework.javapoet.TypeName typeName(ResolvableType resolvableType)
      Obtain a TypeName for the underlying type of the given ResolvableType. Can render a class name, a type signature or a generic type variable.
      Parameters:
      resolvableType - the resolvable type represent.
      Returns:
      the corresponding TypeName.
    • typeNameOrWrapper

      public static org.springframework.javapoet.TypeName typeNameOrWrapper(Class<?> type)
      Obtain a TypeName for the given type, resolving primitive wrappers as necessary. Ideal to represent a type parameter for parametrized types as primitive boxing is considered.
      Parameters:
      type - the class to be represented.
      Returns:
      the corresponding TypeName.
    • typeNameOrWrapper

      public static org.springframework.javapoet.TypeName typeNameOrWrapper(ResolvableType resolvableType)
      Obtain a TypeName for the given ResolvableType, resolving primitive wrappers as necessary. Can render a class name, a type signature or a generic type variable. Ideal to represent a type parameter for parametrized types as primitive boxing is considered.
      Parameters:
      resolvableType - the resolvable type to be represented.
      Returns:
      the corresponding TypeName.