|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ValueBindingObject
Please note, the implementation of get methods classes that implement this interface should delegate to the value binding as follows (this is for the "dir" property):
public String getRowData() { if (null != _rowData) { return _rowData; } ValueBinding valueBinding = getValueBinding("rowData"); if (null != valueBinding) { return (String) valueBinding.getValue(getFacesContext()); } return null; }The exception is properties that are specifically designed not to have "Compute Dynamically" values (and are configured allow-run-time-bindings>false< in the xsp-config files so that dynamically computed values cause a design-time error). An example is the
DataSource.getVar()
property, where the var is determined when the
XPage is designed.
Initializing the property in the constructor or inline in the Java field declaration is discouraged, as the default value should usually be null, and code using the property value should check for null, both for when the value is not set, and for when the value is computed but the computed expression doesn't return a value.
The template for Java primitive values is different. Since they can't be checked for null, an extra boolean variable is used to track whether the value has been set.
private int maxlength = Integer.MIN_VALUE; private boolean maxlength_set = false; public void setMaxlength(int maxlength) { this.maxlength = maxlength; this.maxlength_set = true; } public int getMaxlength() { if (this.maxlength_set) { return this.maxlength; } ValueBinding _vb = getValueBinding("maxlength"); //$NON-NLS-1$ if (_vb != null) { Object _result = _vb.getValue(getFacesContext()); if (_result == null) { return Integer.MIN_VALUE; } else { return ((Integer) _result).intValue(); } } else { return this.maxlength; } } int maxlength = tcomponent.getMaxlength(); if(maxlength>=0) { writer.writeAttribute("maxlength", maxlength, "maxlength"); // $NON-NLS-1$ $NON-NLS-2$ }
Method Summary | |
---|---|
javax.faces.el.ValueBinding |
getValueBinding(java.lang.String property)
Return the ValueBinding instance to used to calculate the value for the specified property. |
void |
setValueBinding(java.lang.String property,
javax.faces.el.ValueBinding binding)
Set the ValueBinding instance to used to calculate the value for the specified property. |
Method Detail |
---|
javax.faces.el.ValueBinding getValueBinding(java.lang.String property)
property
- Name of the property
void setValueBinding(java.lang.String property, javax.faces.el.ValueBinding binding)
property
- Name of the propertybinding
- The ValueBinding to set, or null to remove an existing ValueBinding
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |