org.osgi.util.converter

## Class TypeReference<T>

- java.lang.Object
- - org.osgi.util.converter.TypeReference<T>

Type Parameters:
  `T` - The target type for the conversion.

    @ConsumerType
    public class TypeReference<T>
    extends Object

An object does not carry any runtime information about its generic type. However sometimes it is necessary to specify a generic type, that is the purpose of this class. It allows you to specify an generic type by defining a type T, then subclassing it. The subclass will have a reference to the super class that contains this generic information. Through reflection, we pick this reference up and return it with the getType() call.

     List<String> result = converter.convert(Arrays.asList(1, 2, 3))
                    .to(new TypeReference<List<String>>() {});

Author:
  $Id$

### Constructor Summary

Constructors
`protected` `TypeReference()` A `TypeReference` cannot be directly instantiated.

### Method Summary

All Methods Instance Methods Concrete Methods
`Type` `getType()` Return the actual type of this Type Reference

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

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### TypeReference

    protected TypeReference()

A `TypeReference` cannot be directly instantiated. To use it, it has to be extended, typically as an anonymous inner class.

### Method Detail

#### getType

    public Type getType()

Return the actual type of this Type Reference

Returns:
  the type of this reference.