public final class

TypeArguments

extends Object
java.lang.Object
   ↳ org.eclipse.sisu.inject.TypeArguments

Class Overview

Utility methods for dealing with generic type arguments.

Summary

Public Methods
static TypeLiteral[]<?> get(TypeLiteral<?> typeLiteral)
Get all type arguments from a generic type, for example [Foo,Bar] from Map<Foo,Bar>.
static TypeLiteral<?> get(TypeLiteral<?> typeLiteral, int index)
Get an indexed type argument from a generic type, for example Bar from Map<Foo,Bar>.
static <T> Key<T> implicitKey(Class<T> clazz)
Creates a special binding key for the given implicit type.
static boolean isAssignableFrom(TypeLiteral<?> superLiteral, TypeLiteral<?> subLiteral)
Determines if the sub-type can be converted to the generic super-type via an identity or widening conversion.
static boolean isConcrete(Class<?> clazz)
Determines if the given raw type represents a concrete type.
static boolean isConcrete(TypeLiteral<?> literal)
Determines if the given generic type represents a concrete type.
static boolean isImplicit(TypeLiteral<?> literal)
Determines if the given generic type represents an implicit binding.
static boolean isImplicit(Class<?> clazz)
Determines if the given raw type represents an implicit binding.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static TypeLiteral[]<?> get (TypeLiteral<?> typeLiteral)

Get all type arguments from a generic type, for example [Foo,Bar] from Map<Foo,Bar>.

Parameters
typeLiteral The generic type
Returns
  • Array of type arguments

public static TypeLiteral<?> get (TypeLiteral<?> typeLiteral, int index)

Get an indexed type argument from a generic type, for example Bar from Map<Foo,Bar>.

Parameters
typeLiteral The generic type
index The argument index
Returns
  • Indexed type argument; TypeLiteral<Object> if the given type is a raw class

public static Key<T> implicitKey (Class<T> clazz)

Creates a special binding key for the given implicit type.

Parameters
clazz The implicit type
Returns
  • Implicit binding key

public static boolean isAssignableFrom (TypeLiteral<?> superLiteral, TypeLiteral<?> subLiteral)

Determines if the sub-type can be converted to the generic super-type via an identity or widening conversion.

Parameters
superLiteral The generic super-type
subLiteral The generic sub-type
Returns
  • true if the sub-type can be converted to the generic super-type; otherwise false

public static boolean isConcrete (Class<?> clazz)

Determines if the given raw type represents a concrete type.

Parameters
clazz The raw type
Returns
  • true if the raw type is concrete; otherwise false

public static boolean isConcrete (TypeLiteral<?> literal)

Determines if the given generic type represents a concrete type.

Parameters
literal The generic type
Returns
  • true if the generic type is concrete; otherwise false

public static boolean isImplicit (TypeLiteral<?> literal)

Determines if the given generic type represents an implicit binding.

Parameters
literal The generic type
Returns
  • true if the generic type is implicit; otherwise false

public static boolean isImplicit (Class<?> clazz)

Determines if the given raw type represents an implicit binding.

Parameters
clazz The raw type
Returns
  • true if the raw type is implicit; otherwise false