public JBBPIntegerValueEvaluator make ( final String expression , final List < JBBPNamedFieldInfo > namedFields , final byte [ ] compiledScript ) { final JBBPIntegerValueEvaluator result ; if ( JBBPExpressionEvaluator . hasExpressionOperators ( expression ) ) { // expression result = new JBBPExpressionEvaluator ( expression , namedFields , compiledScript ) ; } else { // only field int index = - 1 ; if ( expression . startsWith ( "$" ) ) { result = new JBBPOnlyFieldEvaluator ( expression . substring ( 1 ) , index ) ; } else { for ( int i = namedFields . size ( ) - 1 ; i >= 0 ; i -- ) { final JBBPNamedFieldInfo field = namedFields . get ( i ) ; if ( expression . equals ( field . getFieldPath ( ) ) ) { index = i ; break ; } } if ( index < 0 ) { result = new JBBPExpressionEvaluator ( expression , namedFields , compiledScript ) ; } else { JBBPCompilerUtils . assertFieldIsNotArrayOrInArray ( namedFields . get ( index ) , namedFields , compiledScript ) ; result = new JBBPOnlyFieldEvaluator ( null , index ) ; } } } return result ; }
Make an appropriate evaluator for an expression text .