FileDocCategorySizeDatePackage
GenericReflect.javaAPI DocExample601Sat Apr 23 22:35:44 BST 2005None

GenericReflect

public class GenericReflect extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

		// public interface List<E> extends Collection<E> { }

		TypeVariable []	tv = List.class.getTypeParameters();
		System.out.println( tv[0].getName() ); // E

		class StringList extends ArrayList<String> { }

		Type type = StringList.class.getGenericSuperclass();
		System.out.println( type );  //java.util.ArrayList<java.lang.String>
		ParameterizedType pt = (ParameterizedType)type;
		System.out.println( pt.getActualTypeArguments()[0] );
			//class	java.lang.String