public static boolean isValidImportString ( String s ) { if ( s . equals ( "*" ) ) return true ; boolean valid = true ; String t = s ; int index = t . indexOf ( ' ' ) ; if ( index != - 1 ) { // '*' must be last character... if ( index == t . length ( ) - 1 ) { // ... any and preceding character must be '.' if ( index - 1 >= 0 ) { valid = t . charAt ( index - 1 ) == ' ' ; // Strip off ".*$" for identifier checks t = t . substring ( 0 , t . length ( ) - 2 ) ; } } else return false ; } // Verify string is off the form (javaId \.)+ or javaId if ( valid ) { String [ ] javaIds = t . split ( "\\." , t . length ( ) + 2 ) ; for ( String javaId : javaIds ) valid &= SourceVersion . isIdentifier ( javaId ) ; } return valid ; }
Return true if the argument string is a valid import - style string specifying claimed annotations ; return false otherwise .