javax.enterprise.util

## Class TypeLiteral<T>

- java.lang.Object
- - javax.enterprise.util.TypeLiteral<T>

- Type Parameters:
    `T` - the type, including all actual type parameters
  All Implemented Interfaces:
    Serializable

      public abstract class TypeLiteral<T>
      extends Object
      implements Serializable

  Supports inline instantiation of objects that represent parameterized types with actual type parameters.

  An object that represents any parameterized type may be obtained by subclassing `TypeLiteral`.

       TypeLiteral<List<String>> stringListType = new TypeLiteral<List<String>>() {
       };

  Author:
    Gavin King, Pete Muir
  See Also:
    `Instance.select(TypeLiteral, Annotation...)`, `Event.select(TypeLiteral, Annotation...)`, Serialized Form

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `TypeLiteral()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)`
    `Class<T>` | `getRawType()`
    `Type` | `getType()`
    `int` | `hashCode()`
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### TypeLiteral

          protected TypeLiteral()

  - ### Method Detail

    - #### getType

          public final Type getType()

      Returns:
        the actual type represented by this object

    - #### getRawType

          public final Class<T> getRawType()

      Returns:
        the raw type represented by this object

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 1996-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.