private void checkMethodNames ( Expression expression ) { if ( expression instanceof MethodCallExpr ) { MethodCallExpr methodCall = ( ( MethodCallExpr ) expression ) ; if ( ! methodCall . getScope ( ) . isPresent ( ) ) { String methodName = methodCall . getName ( ) . getIdentifier ( ) ; if ( ! context . hasMethod ( methodName ) && ! context . hasStaticMethod ( methodName ) ) { logger . error ( "Couldn't find the method \"" + methodName + "\". " + "Make sure it is not private." ) ; } } } for ( com . github . javaparser . ast . Node node : expression . getChildNodes ( ) ) { if ( ! ( node instanceof Expression ) ) { continue ; } Expression childExpr = ( Expression ) node ; checkMethodNames ( childExpr ) ; } }
Check the expression for component method calls . This will check that the methods used in the template exist in the Component . It throws an exception if we use a method that is not declared in our Component . This will not check for the type or number of parameters we leave that to the Java Compiler .