public static boolean matchType ( Object expectedType , Class < ? > actualType ) { if ( expectedType == null ) return true ; if ( actualType == null ) throw new NullPointerException ( "Actual type cannot be null" ) ; if ( expectedType instanceof Class < ? > ) return ( ( Class < ? > ) expectedType ) . isAssignableFrom ( actualType ) ; if ( expectedType instanceof String ) return matchTypeByName ( ( String ) expectedType , actualType ) ; if ( expectedType instanceof TypeCode ) return TypeConverter . toTypeCode ( actualType ) . equals ( expectedType ) ; return false ; }
Matches expected type to an actual type . The types can be specified as types type names or TypeCode .