com.ibm.xsp.registry
Interface FacesDefinitionClass

All Known Implementing Classes:
UIDataIterator, UISelectListbox, XspDataIterator, XspSelectManyListbox

public interface FacesDefinitionClass

Implementers must be instances of UIComponent. The class returned must be a non-abstract UIComponent class, with a public, zero-arguments constructor

The use case is as follows: a component tag is defined as having javaClass, which implements FacesDefinitionClass. While creating the .java file corresponding to an .xsp page, the FacesInstance corresponding to the component tag is created. Then (still while creating the .java file) an instance is created of the component tag, with no properties or attributes set on it, and the getJavaClass(FacesInstance) method is invoked on it to get the runtime class. The generated .java file will contain code to create an instance of the runtime class, and set the properties from the .xsp page on the runtime class.

Note, this mechanism is quite error prone, because the FacesDefinition used to set the properties onto the runtime class is the definition for this FacesDefinitionClass. Every difference between the properties defined in the .xsp-config for the FacesDefinitionClass and the actual properties of the runtime class leads to a potential for runtime errors.
For example, if the FacesDefinitionClass .xsp-config defined the property "foo" as being of type int, but the runtime class only had the method setFoo(String) then an .xsp page containing the property foo would throw a runtime exception.
As another example, if the FacesDefinitionClass defined a property "bar" but the runtime class did not have a setBar(..) method, and the user set the property "bar" to a value binding that could return null, then there would be a runtime exception when attempting to set the property to null.


Method Summary
 java.lang.Class<? extends javax.faces.component.UIComponent> getJavaClass(com.ibm.xsp.page.parse.types.FacesInstance instance)
          The class returned must be a non-abstract UIComponent class, with a public, zero-arguments constructor.
 

Method Detail

getJavaClass

java.lang.Class<? extends javax.faces.component.UIComponent> getJavaClass(com.ibm.xsp.page.parse.types.FacesInstance instance)
The class returned must be a non-abstract UIComponent class, with a public, zero-arguments constructor.

Note, none of the properties or attributes will have been set on this UIComponent when this method is invoked - only the constructor will have been called. This UIComponent will then be discarded after invoking this method.

The implementation is expected to examine the properties of the tag in the FacesInstance to decide which runtime class to return. (If the implementation always returns the same class, then this mechanism need not be used - instead just declare the tag's java class as being that runtime class)

Parameters:
instance - an instance of a tag in an .xsp, where the java class defined for the tag is this UIComponent class.
Returns: