question: @ SuppressWarnings ( "unchecked" ) public static void checkType ( Map < String , Object > map , String name ) { Map < String , Object > tmap ; if ( map . get ( MetamodelGenerator . KEY_TYPE ) instanceof Map ) { tmap = ( Map < String , Object > ) map . get ( MetamodelGenerator . KEY_TYPE ) ; } else if ( map . get ( MetamodelGenerator . KEY_TYPE ) instanceof String ) { tmap = new HashMap < String , Object > ( ) ; tmap . put ( MetamodelGenerator . KEY_NAME , map . get ( MetamodelGenerator . KEY_TYPE ) ) ; } else { tmap = map ; } int join = name . indexOf ( '&' ) ; if ( join > 0 ) { while ( join > 0 && ! pointyBracketsEven ( name . substring ( 0 , join ) ) ) { join = name . indexOf ( '&' , join + 1 ) ; } if ( join > 0 ) { Assert . assertEquals ( "not an intersection type" , "i" , tmap . get ( "comp" ) ) ; checkTypeParameters ( - 1 , ( List < Map < String , Object > > ) tmap . get ( MetamodelGenerator . KEY_TYPES ) , name . substring ( 0 , join ) ) ; checkTypeParameters ( - 1 , ( List < Map < String , Object > > ) tmap . get ( MetamodelGenerator . KEY_TYPES ) , name . substring ( join + 1 ) ) ; return ; } } join = name . indexOf ( '|' ) ; if ( join > 0 ) { while ( join > 0 && ! pointyBracketsEven ( name . substring ( 0 , join ) ) ) { join = name . indexOf ( '|' , join + 1 ) ; } if ( join > 0 ) { Assert . assertEquals ( "not a union type" , "u" , tmap . get ( "comp" ) ) ; checkTypeParameters ( - 1 , ( List < Map < String , Object > > ) tmap . get ( MetamodelGenerator . KEY_TYPES ) , name . substring ( 0 , join ) ) ; checkTypeParameters ( - 1 , ( List < Map < String , Object > > ) tmap . get ( MetamodelGenerator . KEY_TYPES ) , name . substring ( join + 1 ) ) ; return ; } } int sep = name . indexOf ( '<' ) ; String typeParams = null ; if ( sep > 0 ) { typeParams = name . substring ( sep + 1 , name . length ( ) - 1 ) ; name = name . substring ( 0 , sep ) ; } if ( tmap . containsKey ( MetamodelGenerator . KEY_PACKAGE ) ) { Assert . assertEquals ( name , String . format ( "%s::%s" , packageName ( tmap ) , tmap . get ( MetamodelGenerator . KEY_NAME ) ) ) ; } else { Assert . assertEquals ( name , tmap . get ( MetamodelGenerator . KEY_NAME ) ) ; } if ( typeParams != null ) { List < Map < String , Object > > tparms = ( List < Map < String , Object > > ) tmap . get ( MetamodelGenerator . KEY_TYPE_PARAMS ) ; Assert . assertFalse ( "Type parameters shouldn't be empty" , tparms . isEmpty ( ) ) ; checkTypeParameters ( 0 , tparms , typeParams ) ; } }
target:  Check that the map either contains the specified type or is the specified type. The type name can be parameterized, i.e. Sequence&lt;String&gt; (but with fully qualified names); when it's parameterized, the type parameters are checked as well. 