public static final Class [ ] getParameterTypes ( Object bean , String property ) { Type type = ( Type ) doFor ( bean , property , null , ( Object a , int i ) -> { Object o = Array . get ( a , i ) ; return o != null ? o . getClass ( ) . getComponentType ( ) : null ; } , ( List l , int i ) -> { return l . get ( i ) . getClass ( ) . getGenericSuperclass ( ) ; } , ( Object o , Class c , String p ) -> { return getField ( c , p ) . getGenericType ( ) ; } , ( Object o , Method m ) -> { return m . getGenericReturnType ( ) ; } ) ; if ( type instanceof ParameterizedType ) { ParameterizedType pt = ( ParameterizedType ) type ; Type [ ] ata = pt . getActualTypeArguments ( ) ; if ( ata . length > 0 ) { Class [ ] ca = new Class [ ata . length ] ; for ( int ii = 0 ; ii < ca . length ; ii ++ ) { ca [ ii ] = ( Class ) ata [ ii ] ; } return ca ; } } if ( type instanceof Class ) { Class cls = ( Class ) type ; if ( cls . isArray ( ) ) { cls = cls . getComponentType ( ) ; } return new Class [ ] { cls } ; } return null ; }
Returns actual parameter types for property