@Override public Object visitMethod(MethodExpression method_expression,MethodOperator method,List<Object> parameters){
  StringBuilder sb=new StringBuilder();
  if (parameters.size() == 1) {
switch (method) {
case CEILING:
      sb.append("CEILING(");
    break;
case DAY:
  sb.append("DAYOFMONTH(");
break;
case FLOOR:
sb.append("FLOOR(");
break;
case HOUR:
sb.append("HOUR(");
break;
case LENGTH:
sb.append("LENGTH(");
break;
case MINUTE:
sb.append("MINUTE(");
break;
case MONTH:
sb.append("MONTH(");
break;
case ROUND:
sb.append("ROUND(");
break;
case SECOND:
sb.append("SECOND(");
break;
case TOUPPER:
sb.append("UPPER(");
break;
case TOLOWER:
sb.append("LOWER(");
break;
case TRIM:
sb.append("TRIM(");
break;
case YEAR:
sb.append("YEAR(");
break;
default :
throw new UnsupportedOperationException("Unsupported method: " + method.toUriLiteral());
}
sb.append(parameters.get(0));
sb.append(')');
}
 else if (method == MethodOperator.INDEXOF || method == MethodOperator.CONCAT || method == MethodOperator.SUBSTRING) {
switch (method) {
case INDEXOF:
sb.append("LOCATE(");
break;
case CONCAT:
sb.append("CONCAT(");
break;
case SUBSTRING:
sb.append("SUBSTR(");
break;
default :
}
sb.append(parameters.get(0));
sb.append(',');
sb.append(parameters.get(1));
sb.append(')');
}
 else {
switch (method) {
case ENDSWITH:
sb.append(parameters.get(0));
sb.append(" LIKE '%");
sb.append(removeApostrophes(parameters.get(1)));
sb.append("'");
break;
case STARTSWITH:
sb.append(parameters.get(0));
sb.append(" LIKE '");
sb.append(removeApostrophes(parameters.get(1)));
sb.append("%'");
break;
case SUBSTRINGOF:
sb.append(parameters.get(1));
sb.append(" LIKE '%");
sb.append(removeApostrophes(parameters.get(0)));
sb.append("%'");
break;
default :
throw new UnsupportedOperationException("Unsupported method: " + method.toUriLiteral());
}
}
return sb.toString();
}

@ Override public Object visitMethod ( MethodExpression method_expression , MethodOperator method , List < Object > parameters ) { StringBuilder sb = new StringBuilder ( ) ; if ( parameters . size ( ) == 1 ) { switch ( method ) { case CEILING : sb . append ( "CEILING(" ) ; break ; case DAY : sb . append ( "DAYOFMONTH(" ) ; break ; case FLOOR : sb . append ( "FLOOR(" ) ; break ; case HOUR : sb . append ( "HOUR(" ) ; break ; case LENGTH : sb . append ( "LENGTH(" ) ; break ; case MINUTE : sb . append ( "MINUTE(" ) ; break ; case MONTH : sb . append ( "MONTH(" ) ; break ; case ROUND : sb . append ( "ROUND(" ) ; break ; case SECOND : sb . append ( "SECOND(" ) ; break ; case TOUPPER : sb . append ( "UPPER(" ) ; break ; case TOLOWER : sb . append ( "LOWER(" ) ; break ; case TRIM : sb . append ( "TRIM(" ) ; break ; case YEAR : sb . append ( "YEAR(" ) ; break ; default : throw new UnsupportedOperationException ( "Unsupported method: " + method . toUriLiteral ( ) ) ; } sb . append ( parameters . get ( 0 ) ) ; sb . append ( ')' ) ; } else if ( method == MethodOperator . INDEXOF || method == MethodOperator . CONCAT || method == MethodOperator . SUBSTRING ) { switch ( method ) { case INDEXOF : sb . append ( "LOCATE(" ) ; break ; case CONCAT : sb . append ( "CONCAT(" ) ; break ; case SUBSTRING : sb . append ( "SUBSTR(" ) ; break ; default : } sb . append ( parameters . get ( 0 ) ) ; sb . append ( ',' ) ; sb . append ( parameters . get ( 1 ) ) ; sb . append ( ')' ) ; } else { switch ( method ) { case ENDSWITH : sb . append ( parameters . get ( 0 ) ) ; sb . append ( " LIKE '%" ) ; sb . append ( removeApostrophes ( parameters . get ( 1 ) ) ) ; sb . append ( "'" ) ; break ; case STARTSWITH : sb . append ( parameters . get ( 0 ) ) ; sb . append ( " LIKE '" ) ; sb . append ( removeApostrophes ( parameters . get ( 1 ) ) ) ; sb . append ( "%'" ) ; break ; case SUBSTRINGOF : sb . append ( parameters . get ( 1 ) ) ; sb . append ( " LIKE '%" ) ; sb . append ( removeApostrophes ( parameters . get ( 0 ) ) ) ; sb . append ( "%'" ) ; break ; default : throw new UnsupportedOperationException ( "Unsupported method: " + method . toUriLiteral ( ) ) ; } } return sb . toString ( ) ; }
translates to an sql function .
