public static boolean isMatched ( Map < String , Object > patterns , String className ) { // Array [] object class names are "[x", where x is the first letter of the array type // -> NO '.' in class name, thus! // see http://download.oracle.com/javase/6/docs/api/java/lang/Class.html#getName%28%29 String qualifiedNamespace = className ; String name = className ; if ( className . indexOf ( ' ' ) > 0 ) { qualifiedNamespace = className . substring ( 0 , className . lastIndexOf ( ' ' ) ) . trim ( ) ; name = className . substring ( className . lastIndexOf ( ' ' ) + 1 ) . trim ( ) ; } else if ( className . indexOf ( ' ' ) == 0 ) { qualifiedNamespace = className . substring ( 0 , className . lastIndexOf ( ' ' ) ) ; } Object object = patterns . get ( qualifiedNamespace ) ; if ( object == null ) { return true ; } else if ( STAR . equals ( object ) ) { return false ; } else if ( patterns . containsKey ( "*" ) ) { // for now we assume if the name space is * then we have a catchall *.* pattern return true ; } else { List list = ( List ) object ; return ! list . contains ( name ) ; } }
Determines if a given full qualified class name matches any import style patterns .