class Json<T>
{
@SerializedName( "T's type here" )
private final ArrayList<T> _bucket = new ArrayList<T>( 5 );
...
}
I'd like to know how (if possible) the generic parameters of a class can be determined at run-time. From what I've read this is possible with sub-classes of generic types, but I haven't been able to find out how to do it with the type itself. There's some great info in these links, but I'm not sure it's what I'm looking for.
http://blog.xebia.com/2009/02/07/acessing-generic-types-at-runtime-in-java www.artima.com/weblogs/viewpost.jsp?thread=208860
What I'm ultimately trying to accomplish, is to get Gson to serialize the '_bucket' variable above, as the class name of type 'T'.
I'd appreciate it if someone could point me in the right direction.