public static Class < ? > resolveTypeArgument ( Class < ? > clazz , Class < ? > genericIfc ) { Class < ? > [ ] typeArgs = resolveTypeArguments ( clazz , genericIfc ) ; if ( typeArgs == null ) { return null ; } if ( typeArgs . length != 1 ) { throw new IllegalArgumentException ( "Expected 1 type argument on generic interface [" + genericIfc . getName ( ) + "] but found " + typeArgs . length ) ; } return typeArgs [ 0 ] ; }
Resolve the single type argument of the given generic interface against the given target class which is assumed to implement the generic interface and possibly declare a concrete type for its type variable .