ExpressionVisitorImpl implements ExpressionVisitor<Object> { @Override public Object visitMethodExpression( List<Object> expressions, MethodExpression.Type type) { if (type == MethodExpression.Type.CONTAINS) { if (expressions.size() != 2) { throw new UnsupportedOperationException( StringBundler.concat( "Unsupported method visitMethodExpression with method", "type ", type, " and ", expressions.size(), "params")); } return _contains( (EntityField)expressions.get(0), expressions.get(1), _locale); } if (type == MethodExpression.Type.STARTS_WITH) { if (expressions.size() != 2) { throw new UnsupportedOperationException( StringBundler.concat( "Unsupported method visitMethodExpression with method", "type ", type, " and ", expressions.size(), "params")); } return _startsWith( (EntityField)expressions.get(0), expressions.get(1), _locale); } throw new UnsupportedOperationException( "Unsupported method visitMethodExpression with method type " + type); } ExpressionVisitorImpl(
		Format format, Locale locale, EntityModel entityModel); @Override Filter visitBinaryExpressionOperation(
		BinaryExpression.Operation operation, Object left, Object right); @Override Object visitCollectionPropertyExpression(
			CollectionPropertyExpression collectionPropertyExpression); @Override Object visitComplexPropertyExpression(
		ComplexPropertyExpression complexPropertyExpression); @Override Object visitLambdaFunctionExpression(
			LambdaFunctionExpression.Type type, String variable,
			Expression expression); @Override EntityField visitLambdaVariableExpression(
			LambdaVariableExpression lambdaVariableExpression); @Override Object visitListExpressionOperation(
			ListExpression.Operation operation, Object left, List<Object> right); @Override Object visitLiteralExpression(LiteralExpression literalExpression); @Override Object visitMemberExpression(MemberExpression memberExpression); @Override Object visitMethodExpression(
		List<Object> expressions, MethodExpression.Type type); @Override Object visitPrimitivePropertyExpression(
		PrimitivePropertyExpression primitivePropertyExpression); @Override Filter visitUnaryExpressionOperation(
		UnaryExpression.Operation operation, Object operand);  }
@Test public void testVisitMethodExpressionWithStartsWith() { Map<String, EntityField> entityFieldsMap = _entityModel.getEntityFieldsMap(); EntityField entityField = entityFieldsMap.get("title"); String value = "title1"; PrefixFilter prefixFilter = (PrefixFilter)_expressionVisitorImpl.visitMethodExpression( Arrays.asList(Arrays.array(entityField, value)), MethodExpression.Type.STARTS_WITH); Assert.assertEquals(entityField.getName(), prefixFilter.getField()); Assert.assertEquals(value, prefixFilter.getPrefix()); }