public static Type getCollectionComponentType ( Type collectionType ) { Type componentType = GenericTypeReflector . getTypeParameter ( collectionType , Collection . class . getTypeParameters ( ) [ 0 ] ) ; if ( componentType == null ) // if it was a raw type, just assume Object return Object . class ; else return componentType ; }
Get the component type of a Collection .