net.jakubholy.jeeutils.jsfelcheck.validator
Interface JsfElValidator

All Known Implementing Classes:
ValidatingJsfElResolver

public interface JsfElValidator


Method Summary
 JsfElValidator declareVariable(String name, Object value)
           
 JsfElValidator definePropertyTypeOverride(String mapJsfExpression, Class<?> newType)
          Specify the type of a 'property' in a JSF EL expression, usually a component of a collection etc.
 ValidationResult validateMethodElExpression(String expression)
           
 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.
 

Method Detail

validateValueElExpression

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. (So the value isn't really interesting as it isn't determined based on real objects, it's only important to verify that it is not null or that it is an instance of the expected type.)

Parameters:
elExpression - (required) Ex.: #{aBean}, #{aBean.aProperty}, #{aBean['key'].property}

declareVariable

JsfElValidator declareVariable(String name,
                               Object value)

definePropertyTypeOverride

JsfElValidator definePropertyTypeOverride(String mapJsfExpression,
                                          Class<?> newType)
Specify the type of a 'property' in a JSF EL expression, usually a component of a collection etc. If you have #{myBean.myMap['anyKey'].whatever} you may declare the type returned from the myMap by specifying override for 'myBean.myMap.*' to be e.g. WhateverType.class.

There 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

Parameters:
mapJsfExpression - The expression where to override the guessed type with only names and dots, perhaps plus .*; i.e. 'var.prop['key']' becomes var.prop
newType -

validateMethodElExpression

ValidationResult validateMethodElExpression(String expression)


Copyright © 2011. All Rights Reserved.