protected JavaSource getJavaSourceForClass ( String clazzname ) { String resource = clazzname . replaceAll ( "\\." , "/" ) + ".java" ; FileObject fileObject = classPath . findResource ( resource ) ; if ( fileObject == null ) { return null ; } Project project = FileOwnerQuery . getOwner ( fileObject ) ; if ( project == null ) { return null ; } SourceGroup [ ] sourceGroups = ProjectUtils . getSources ( project ) . getSourceGroups ( "java" ) ; for ( SourceGroup sourceGroup : sourceGroups ) { return JavaSource . create ( ClasspathInfo . create ( sourceGroup . getRootFolder ( ) ) ) ; } return null ; }
Resolves the clazzname to a fileobject of the java - file