public static boolean isPackageOrClassName ( String s ) { if ( S . blank ( s ) ) { return false ; } S . List parts = S . fastSplit ( s , "." ) ; if ( parts . size ( ) < 2 ) { return false ; } for ( String part : parts ) { if ( ! Character . isJavaIdentifierStart ( part . charAt ( 0 ) ) ) { return false ; } for ( int i = 1 , len = part . length ( ) ; i < len ; ++ i ) { if ( ! Character . isJavaIdentifierPart ( part . charAt ( i ) ) ) { return false ; } } } return true ; }
Check if a given string is a valid java package or class name .