Top Description Constructors Methods
org.osgi.util.converter

public Class TypeReference<T>

extends Object
Class Inheritance
Annotations
@ConsumerType
Type Parameters
<T>
The target type for the conversion.
Imports
java.lang.reflect.ParameterizedType, .Type, org.osgi.annotation.versioning.ConsumerType

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: a32435948880bf0119a8a6f09e7f6ffa17b9a390 $

Constructor Summary

AccessConstructor and Description
protected
TypeReference()

A TypeReference cannot be directly instantiated.

Method Summary

Modifier and TypeMethod and Description
public Type

Returns:

the type of this reference.
getType
()

Return the actual type of this Type Reference

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

TypeReferenceback to summary
protected TypeReference()

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

Method Detail

getTypeback to summary
public Type getType()

Return the actual type of this Type Reference

Returns:Type

the type of this reference.