Keel 2.1RC2

org.keel.faces.el
Class ValueBindingImpl

java.lang.Object
  extended byValueBinding
      extended byorg.keel.faces.el.ValueBindingImpl

public class ValueBindingImpl
extends ValueBinding

TODO: Needs lots of cleanup

See Also:
Serialized Form

Field Summary
protected  Application _application
           
protected  java.lang.Object[] _parsedReference
           
protected  java.lang.String _reference
           
private static java.lang.Integer ONE
           
private static java.lang.Integer ZERO
           
private static java.lang.Integer ZERO_FROM_EMPTY
           
 
Constructor Summary
ValueBindingImpl(java.lang.String reference, Application application)
           
 
Method Summary
private  java.lang.Object coerceProperty(java.lang.Object base, java.lang.Object name)
          Get a simple (not nested) property name and type (int or String) as defined in JSF 1.0, PRD2, 5.1.2
private  java.lang.Integer coerceToInteger(java.lang.Object obj)
          Coerces the supplied object to Integer based on coercion rules defined in JSF 1.0, PRD2, 5.1.2.4
private  java.lang.String coerceToString(java.lang.Object obj)
          Coerces the supplied object to String based on coercion rules defined in JSF 1.0, PRD2, 5.1.2.4
private  java.lang.Object getIndex(java.lang.String reference, int indexofOpeningBracket, int indexofClosingBracket)
           
protected  java.lang.Class getPropertyType(FacesContext facesContext, java.lang.Object base, java.lang.Object name)
           
protected  java.lang.Object getPropertyValue(FacesContext facesContext, java.lang.Object base, java.lang.Object name)
          Gets the value of property name from object base.
 java.lang.Class getType(FacesContext facesContext)
           
 java.lang.Object getValue(FacesContext facesContext)
           
private static int indexOfMatchingClosingBracket(java.lang.String str, int indexofOpeningBracket)
          Return the index of the matching (posibly multi-level nested) closing bracket
protected  boolean isPropertyReadOnly(FacesContext facesContext, java.lang.Object base, java.lang.Object name)
           
 boolean isReadOnly(FacesContext facesContext)
           
private  java.lang.Object[] parse(java.lang.String reference)
           
private  java.lang.Object preprocessProperty(FacesContext facesContext, java.lang.Object base, java.lang.Object name)
           
protected  java.lang.Object resolve(FacesContext facesContext)
           
protected  java.lang.Object resolve(FacesContext facesContext, java.lang.Object base, int start)
           
protected  void setPropertyValue(FacesContext facesContext, java.lang.Object base, java.lang.Object name, java.lang.Object newValue)
           
 void setValue(FacesContext facesContext, java.lang.Object newValue)
           
private static java.lang.String stripBracketsFromModelReference(java.lang.String modelReference)
          Strip "${" and "}" from a modelReference, if any
private static java.lang.String unescape(java.lang.String str)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ZERO_FROM_EMPTY

private static final java.lang.Integer ZERO_FROM_EMPTY

ZERO

private static final java.lang.Integer ZERO

ONE

private static final java.lang.Integer ONE

_application

protected Application _application

_reference

protected java.lang.String _reference

_parsedReference

protected java.lang.Object[] _parsedReference
Constructor Detail

ValueBindingImpl

public ValueBindingImpl(java.lang.String reference,
                        Application application)
Method Detail

isReadOnly

public boolean isReadOnly(FacesContext facesContext)
                   throws PropertyNotFoundException
Throws:
PropertyNotFoundException

getType

public java.lang.Class getType(FacesContext facesContext)
                        throws PropertyNotFoundException
Throws:
PropertyNotFoundException

setValue

public void setValue(FacesContext facesContext,
                     java.lang.Object newValue)
              throws PropertyNotFoundException
Throws:
PropertyNotFoundException

getValue

public java.lang.Object getValue(FacesContext facesContext)
                          throws PropertyNotFoundException
Throws:
PropertyNotFoundException

isPropertyReadOnly

protected boolean isPropertyReadOnly(FacesContext facesContext,
                                     java.lang.Object base,
                                     java.lang.Object name)

getPropertyType

protected java.lang.Class getPropertyType(FacesContext facesContext,
                                          java.lang.Object base,
                                          java.lang.Object name)

setPropertyValue

protected void setPropertyValue(FacesContext facesContext,
                                java.lang.Object base,
                                java.lang.Object name,
                                java.lang.Object newValue)

getPropertyValue

protected java.lang.Object getPropertyValue(FacesContext facesContext,
                                            java.lang.Object base,
                                            java.lang.Object name)
Gets the value of property name from object base. Call the appropriate PropertyResolver.getValue method based on the type (int or String) of name

Parameters:
facesContext - facesContext to resolve abgainst
base - the bean whose property to get
name - the name or index of the property
Returns:
the value of requested property

resolve

protected java.lang.Object resolve(FacesContext facesContext)

resolve

protected java.lang.Object resolve(FacesContext facesContext,
                                   java.lang.Object base,
                                   int start)

coerceProperty

private java.lang.Object coerceProperty(java.lang.Object base,
                                        java.lang.Object name)
Get a simple (not nested) property name and type (int or String) as defined in JSF 1.0, PRD2, 5.1.2

We need this function, because PropertyResolver does not provide getValue function where the property is of type Object. Therefore, we must decide which getValue function to call

Parameters:
base - the bean to access
name - the property to access, will be coerced to String or Integer as needed
Returns:
the name or index of the property

coerceToInteger

private java.lang.Integer coerceToInteger(java.lang.Object obj)
Coerces the supplied object to Integer based on coercion rules defined in JSF 1.0, PRD2, 5.1.2.4

Note: null object or empty string are coerced to 0 (zero)--per JSF

Parameters:
obj - the object to coerce
Returns:
int the int value of obj
Throws:
ReferenceSyntaxException - on eny error during coercion

coerceToString

private java.lang.String coerceToString(java.lang.Object obj)
Coerces the supplied object to String based on coercion rules defined in JSF 1.0, PRD2, 5.1.2.4

Note: null object coerced to empty string--per JSF

Parameters:
obj - the object to coerce
Returns:
String the String value of obj
Throws:
ReferenceSyntaxException - on eny error during coercion

indexOfMatchingClosingBracket

private static int indexOfMatchingClosingBracket(java.lang.String str,
                                                 int indexofOpeningBracket)
Return the index of the matching (posibly multi-level nested) closing bracket

Parameters:
str - string to search
indexofOpeningBracket - the location of opening bracket to match
Returns:
the index of the matching closing bracket
Throws:
ReferenceSyntaxException - if matching bracket cannot be found

preprocessProperty

private java.lang.Object preprocessProperty(FacesContext facesContext,
                                            java.lang.Object base,
                                            java.lang.Object name)

stripBracketsFromModelReference

private static java.lang.String stripBracketsFromModelReference(java.lang.String modelReference)
Strip "${" and "}" from a modelReference, if any

Parameters:
modelReference - the model reference
Returns:
the model reference, with "${" and "}" removed

getIndex

private java.lang.Object getIndex(java.lang.String reference,
                                  int indexofOpeningBracket,
                                  int indexofClosingBracket)

parse

private java.lang.Object[] parse(java.lang.String reference)

unescape

private static java.lang.String unescape(java.lang.String str)

Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.