Class SyntheticPojoGenericTypeModel<T>

All Implemented Interfaces:

public final class SyntheticPojoGenericTypeModel<T> extends AbstractPojoGenericTypeModel<T>
A synthetic implementation of PojoTypeModel, i.e. one that is not bound to an actual Java type, but simulates one.
  • Method Details

    • array

      public static <T> PojoTypeModel<T[]> array(PojoRawTypeModel<? super T[]> rawTypeModel, PojoTypeModel<T> elementType)
    • genericType

      public static <T> PojoTypeModel<T> genericType(PojoRawTypeModel<? super T> rawTypeModel, PojoTypeModel<?> firstTypeArgument, PojoTypeModel<?>... otherTypeArguments)
    • opaqueType

      public static <T> PojoTypeModel<T> opaqueType(PojoRawTypeModel<T> rawTypeModel)
    • name

      public String name()
      A human-readable name for this type.
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface PojoTypeModel<T>
      equals in class Object
      true if obj is a PojoTypeModel referencing the exact same type with the exact same exposed metadata.
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface PojoTypeModel<T>
      hashCode in class Object
    • castTo

      public <U> Optional<PojoTypeModel<? extends U>> castTo(Class<U> target)
      Type Parameters:
      U - The type to cast to.
      target - The type to cast to.
      A new type model, representing the current type cast to the given type, or Optional.empty() if casting is not supported. The type model will retain as much contextual type information as possible (type arguments, ...), so casting List<Integer> to Collection for example would return Collection<Integer>.
    • arrayElementType

      public Optional<PojoTypeModel<?>> arrayElementType()
      The model for the array element type, or an empty optional if the current type is not an array type. Implementations may decide to return a model of the raw array element type, or to retain generics information.
    • typeArgument

      public Optional<? extends PojoTypeModel<?>> typeArgument(Class<?> rawSuperType, int typeParameterIndex)
      rawSuperType - The supertype to resolve type parameters for
      typeParameterIndex - The index of the type parameter to resolve
      The model for the type argument for the type parameter defined in rawSuperType at index typeParameterIndex, or an empty optional if the current type does not extend rawSuperType. Implementations may decide to return a model of the raw type argument, or to retain generics information.