Class TypeHints

java.lang.Object
ru.progrm_jarvis.javacommons.util.TypeHints

public final class TypeHints extends Object
Utilities related to special hacks around Java's types, especially generics.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static @interface 
    Marks the specified method argument as a type hint.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> @NotNull Class<T>
    resolve(@Nullable T @NotNull [] typeHint)
    Resolves the generic type being the component of the provided var-arg array.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • resolve

      @NotNull public static <T> @NotNull Class<T> resolve(@Nullable @Nullable T @NotNull [] typeHint)
      Resolves the generic type being the component of the provided var-arg array. This is intended for automatic type-deduction in generic context without explicit class object specification.
      Type Parameters:
      T - generic type whose class object should be resolved
      Parameters:
      typeHint - array used to discover the type, its contents don't matter and it can be empty
      Returns:
      class object for the given array