@Test public void should_not_fall_back_to_eval_as_method_expr_if_variable_not_found() throws Exception { Class<?> unspecifiedExpressionType = String.class; ValidationResult result = elResolver.validateElExpression( "#{unknownValueObject}", new AttributeInfo("anAttribute", unspecifiedExpressionType)); assertFailureWithCause(result, VariableNotFoundException.class); }
@Override public ValidationResult validateElExpression(String elExpression, AttributeInfo attributeInfo) { boolean attributeTypedAsMethod = MethodExpression.class.isAssignableFrom(attributeInfo.getAttributeType()); boolean attributeTypedAsValue = ValueExpression.class.isAssignableFrom(attributeInfo.getAttributeType()); if (attributeTypedAsMethod) { return validateMethodElExpression(elExpression, true); } else if (attributeTypedAsValue) { return validateValueElExpression(elExpression); } else { ValidationResult validationResult = validateValueElExpression(elExpression); if (isPropertyNotFoundFailure(validationResult)) { return tryValidateAsMethodAfterValueFailed(elExpression, validationResult); } else { return validationResult; } } }
Jsf12ValidatingElResolver implements ValidatingElResolver { @Override public ValidationResult validateElExpression(String elExpression, AttributeInfo attributeInfo) { boolean attributeTypedAsMethod = MethodExpression.class.isAssignableFrom(attributeInfo.getAttributeType()); boolean attributeTypedAsValue = ValueExpression.class.isAssignableFrom(attributeInfo.getAttributeType()); if (attributeTypedAsMethod) { return validateMethodElExpression(elExpression, true); } else if (attributeTypedAsValue) { return validateValueElExpression(elExpression); } else { ValidationResult validationResult = validateValueElExpression(elExpression); if (isPropertyNotFoundFailure(validationResult)) { return tryValidateAsMethodAfterValueFailed(elExpression, validationResult); } else { return validationResult; } } } }
Jsf12ValidatingElResolver implements ValidatingElResolver { @Override public ValidationResult validateElExpression(String elExpression, AttributeInfo attributeInfo) { boolean attributeTypedAsMethod = MethodExpression.class.isAssignableFrom(attributeInfo.getAttributeType()); boolean attributeTypedAsValue = ValueExpression.class.isAssignableFrom(attributeInfo.getAttributeType()); if (attributeTypedAsMethod) { return validateMethodElExpression(elExpression, true); } else if (attributeTypedAsValue) { return validateValueElExpression(elExpression); } else { ValidationResult validationResult = validateValueElExpression(elExpression); if (isPropertyNotFoundFailure(validationResult)) { return tryValidateAsMethodAfterValueFailed(elExpression, validationResult); } else { return validationResult; } } } Jsf12ValidatingElResolver(); }
Jsf12ValidatingElResolver implements ValidatingElResolver { @Override public ValidationResult validateElExpression(String elExpression, AttributeInfo attributeInfo) { boolean attributeTypedAsMethod = MethodExpression.class.isAssignableFrom(attributeInfo.getAttributeType()); boolean attributeTypedAsValue = ValueExpression.class.isAssignableFrom(attributeInfo.getAttributeType()); if (attributeTypedAsMethod) { return validateMethodElExpression(elExpression, true); } else if (attributeTypedAsValue) { return validateValueElExpression(elExpression); } else { ValidationResult validationResult = validateValueElExpression(elExpression); if (isPropertyNotFoundFailure(validationResult)) { return tryValidateAsMethodAfterValueFailed(elExpression, validationResult); } else { return validationResult; } } } Jsf12ValidatingElResolver(); @Override /** {@inheritDoc} */ ValidationResult validateElExpression(String elExpression, AttributeInfo attributeInfo); JsfElValidator declareVariable(String name, Object value); JsfElValidator definePropertyTypeOverride(String mapJsfExpression,
            Class<?> newType); void setUnknownVariableResolver(
            ElVariableResolver unknownVariableResolver); void setIncludeKnownVariablesInException(
            boolean includeKnownVariablesInException); void addElExpressionFilter(ElExpressionFilter elExpressionFilter); }
Jsf12ValidatingElResolver implements ValidatingElResolver { @Override public ValidationResult validateElExpression(String elExpression, AttributeInfo attributeInfo) { boolean attributeTypedAsMethod = MethodExpression.class.isAssignableFrom(attributeInfo.getAttributeType()); boolean attributeTypedAsValue = ValueExpression.class.isAssignableFrom(attributeInfo.getAttributeType()); if (attributeTypedAsMethod) { return validateMethodElExpression(elExpression, true); } else if (attributeTypedAsValue) { return validateValueElExpression(elExpression); } else { ValidationResult validationResult = validateValueElExpression(elExpression); if (isPropertyNotFoundFailure(validationResult)) { return tryValidateAsMethodAfterValueFailed(elExpression, validationResult); } else { return validationResult; } } } Jsf12ValidatingElResolver(); @Override /** {@inheritDoc} */ ValidationResult validateElExpression(String elExpression, AttributeInfo attributeInfo); JsfElValidator declareVariable(String name, Object value); JsfElValidator definePropertyTypeOverride(String mapJsfExpression,
            Class<?> newType); void setUnknownVariableResolver(
            ElVariableResolver unknownVariableResolver); void setIncludeKnownVariablesInException(
            boolean includeKnownVariablesInException); void addElExpressionFilter(ElExpressionFilter elExpressionFilter); static final Pattern RE_LAST_EL_PROPERTY; }