public boolean accept ( File file ) { if ( ! WatcherUtils . isInDirectory ( file , javaSourceDir ) || ! WatcherUtils . hasExtension ( file , "java" ) ) { return false ; } // If the file has been deleted by may have been a controller, return true. // The cleanup will be applied. if ( ! file . isFile ( ) ) { return true ; } //Parse the Java File and check if it's a wisdom Controller try { final CompilationUnit parse = JavaParser . parse ( file ) ; // The visitor return a Boolean object, potentially null. final Boolean accept = parse . accept ( CLASS_VISITOR , null ) ; return accept != null && accept ; } catch ( Exception e ) { getLog ( ) . error ( "Cannot parse " + file . getAbsolutePath ( ) , e ) ; return false ; } }
Check if we can create a model from the given source .