public static boolean isAssignableFrom ( TypeReference < ? > from , TypeReference < ? > to ) { if ( from == null ) { return false ; } if ( to . equals ( from ) ) { return true ; } if ( to . getType ( ) instanceof Class ) { return to . getRawType ( ) . isAssignableFrom ( from . getRawType ( ) ) ; } else if ( to . getType ( ) instanceof ParameterizedType ) { return isAssignableFrom ( from . getType ( ) , ( ParameterizedType ) to . getType ( ) , new HashMap < String , Type > ( ) ) ; } else if ( to . getType ( ) instanceof GenericArrayType ) { return to . getRawType ( ) . isAssignableFrom ( from . getRawType ( ) ) && isAssignableFrom ( from . getType ( ) , ( GenericArrayType ) to . getType ( ) ) ; } else { throw new AssertionError ( "Unexpected Type : " + to ) ; } }
Check if this type is assignable from the given Type .