org.javalid.external.jsf
Class JsfFacadeShared

java.lang.Object
  extended by org.javalid.external.jsf.JsfFacadeShared

public class JsfFacadeShared
extends java.lang.Object

Shared methods for the jsf part of the framework.

Since:
1.0.1
Version:
1.0
Author:
M.Reuvers

Field Summary
static java.lang.String KEY_ANNOTATION_VALIDATOR_LOCATION
          Stores the AnnotationValidator implementation class under servlet context using this key, used by JvJsfContextListener.
static java.lang.String KEY_JSF_CONFIGURATION_LOCATION
          See JsfFacadeShared, this one is here for backwards compatibility only.
 
Constructor Summary
JsfFacadeShared()
           
 
Method Summary
static java.lang.String addExpression(java.lang.String expression)
          Makes an expression for given text.
static boolean containsExpression(java.lang.String value)
          Returns true if given value contains an expression (somewhere in the text).
static AnnotationValidator findAnnotationValidator(javax.faces.context.FacesContext context)
          This method attempts to locate an AnnotationValidator, does NOT initiate one.
static boolean isExpression(java.lang.String value)
          Checks if given value starts with #{ or ${ and ends with }, like a jsf expression.
static JsfFacade newJsfFacade()
          Attempts to create a new JsfFacade in either 1.1 or 1.2 version and returns it.
static java.lang.String removeExpression(java.lang.String expression)
          For given expression string strips the jsf tags, e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_ANNOTATION_VALIDATOR_LOCATION

public static final java.lang.String KEY_ANNOTATION_VALIDATOR_LOCATION
Stores the AnnotationValidator implementation class under servlet context using this key, used by JvJsfContextListener.

See Also:
Constant Field Values

KEY_JSF_CONFIGURATION_LOCATION

public static final java.lang.String KEY_JSF_CONFIGURATION_LOCATION
See JsfFacadeShared, this one is here for backwards compatibility only.

See Also:
JsfFacadeShared, Constant Field Values
Constructor Detail

JsfFacadeShared

public JsfFacadeShared()
Method Detail

findAnnotationValidator

public static final AnnotationValidator findAnnotationValidator(javax.faces.context.FacesContext context)
This method attempts to locate an AnnotationValidator, does NOT initiate one. First it checks if it can be found in the JsfConfigurationDeclarative instance. Currently it checks if it is bound in the ServletContext.

Parameters:
context - The facescontext to check
Returns:
AnnotationValidator instance that is bound somewhere (thru configuration).
Throws:
JavalidException - if the validator could not be found

addExpression

public static final java.lang.String addExpression(java.lang.String expression)
Makes an expression for given text. If it is not already one. Adds #{} around it. Checks for #{} and ${}.

Parameters:
expression - The text to make an expression from
Returns:
Expression

removeExpression

public static final java.lang.String removeExpression(java.lang.String expression)
For given expression string strips the jsf tags, e.g. #{myValue.whatever} strips off #{ and }. Spaces are removed as well (after stripping)

Parameters:
expression - The expression to strip off #{}, or ${}
Returns:
The stripped expression, if expression was null, returns null as well.

isExpression

public static final boolean isExpression(java.lang.String value)
Checks if given value starts with #{ or ${ and ends with }, like a jsf expression. First trims the value of spaces, then performs the check, also the length must be > 3 (thus actually contain something between the braces).

Parameters:
value - The value to check
Returns:
True if it conforms a jsf expression, false otherwise.

containsExpression

public static final boolean containsExpression(java.lang.String value)
Returns true if given value contains an expression (somewhere in the text). E.g:#{bean} or test#{something} would both return true. Checks on #{} and ${}. False if no expression was found.

Parameters:
value - The value to check
Returns:
True if found, false otherwise.
Since:
1.1

newJsfFacade

public static final JsfFacade newJsfFacade()
Attempts to create a new JsfFacade in either 1.1 or 1.2 version and returns it. Throws JavalidException if loading completely fails.

Returns:
JsfVersionFacade
Since:
1.1