|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.jakubholy.jeeutils.jsfelcheck.validator.ValidatingJsfElResolver
public class ValidatingJsfElResolver
A "fake" resolver of JSF EL expression which only checks the validity of the expressions using a custom Variable and Property resolver without requiring real values for the variables being referenced in the expressions. The variable resolver resolvers against a pre-defined list of known variables, the property resolver doesn't actually invoke any getter but just returns a Mock of the appropriate type (so that evaluation of the expression can proceed, which wouldn't be possible if we used real objects and they returned null).
declareVariable(String, Object),
definePropertyTypeOverride(String, Class)| Constructor Summary | |
|---|---|
ValidatingJsfElResolver()
|
|
| Method Summary | |
|---|---|
void |
addElExpressionFilter(ElExpressionFilter elExpressionFilter)
Throw ExpressionRejectedByFilterException for any expression not accepted by the supplied filter. |
JsfElValidator |
declareVariable(String name,
Object value)
|
JsfElValidator |
definePropertyTypeOverride(String elExpression,
Class<?> newType)
Specify the type of a 'property' in a JSF EL expression, usually a component of a collection etc. |
boolean |
isIncludeKnownVariablesInException()
|
void |
setIncludeKnownVariablesInException(boolean includeKnownVariablesInException)
List known variables in VariableNotFoundException? |
void |
setUnknownVariableResolver(ElVariableResolver unknownVariableResolver)
|
ValidationResult |
validateMethodElExpression(String elExpression)
|
ValidationResult |
validateValueElExpression(String elExpression)
Validates that JSF EL is valid and returns its value, which is either a predefined variable or a mock of the class expected to be returned by a property. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ValidatingJsfElResolver()
| Method Detail |
|---|
public void setUnknownVariableResolver(ElVariableResolver unknownVariableResolver)
public ValidationResult validateMethodElExpression(String elExpression)
validateMethodElExpression in interface JsfElValidatorpublic ValidationResult validateValueElExpression(String elExpression)
JsfElValidator
validateValueElExpression in interface JsfElValidatorelExpression - (required) Ex.: #{aBean}, #{aBean.aProperty}, #{aBean['key'].property}
public JsfElValidator declareVariable(String name,
Object value)
declareVariable in interface JsfElValidator
public JsfElValidator definePropertyTypeOverride(String elExpression,
Class<?> newType)
JsfElValidatorThere are two types of overrides: (1) property overrides: pass in the complete property, ex: bean.property1.property2 (2) collection component type overrides: for all sub-properties of a variable/property (unless there is also a property override for it), used for arrays etc. Ex: bean.mapProperty.* => bean.mapProperty['someKey'] and bean.mapProperty.anotherProperty will be both affected by the override
definePropertyTypeOverride in interface JsfElValidatorelExpression - The expression where to override the guessed type with only names and dots, perhaps plus .*; i.e.
'var.prop['key']' becomes var.proppublic void setIncludeKnownVariablesInException(boolean includeKnownVariablesInException)
public void addElExpressionFilter(ElExpressionFilter elExpressionFilter)
ExpressionRejectedByFilterException for any expression not accepted by the supplied filter.
elExpressionFilter - (required)public boolean isIncludeKnownVariablesInException()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||