This package contains Java SE 5 annotations that allow you to register several types of JavaServer Faces artifacts (components, converters, phase listeners, renderers, and validators) without having to define them in a configuration resource. Because the JavaServer Faces runtime does not support classes with arbitrary inheritance hierarchies to implement particular features, the actual classes themselves must also extend the corresponding JavaServer Faces APIs to be usable (with the exception of annotated phase listeners, in which case an adapter instance will be interposed if necessary.
To declare a JavaServer Faces UIComponent
class:
import javax.faces.component.UIComponentBase; import org.apache.shale.tiger.register.FacesComponent; @FacesComponent("com.mycompany.mytypes.MY_COMPONENT_TYPE") public class MyComponent extends UIComponentBase { ... }
To declare a JavaServer Faces by-id Converter
class:
import javax.faces.convert.Converter; import org.apache.shale.tiger.register.FacesConverter; @FacesConverter("com.mycompany.mytypes.MY_CONVERTER_ID") public class MyConverter implements Converter { ... }
To declare a JavaServer Faces Validator
class:
import javax.faces.convert.Validator; import org.apache.shale.tiger.register.Validator; @FacesValidator("com.mycompany.mytypes.MY_VALIDATOR_ID") public class MyValidator implements Validator { ... }
To declare a JavaServer Faces PhaseListener
class (the
BeforePhase
and AfterPhase
event handers are both
optional, and need only be specified if you are interested in that event):
import org.apache.shale.tiger.register.AfterPhase; import org.apache.shale.tiger.register.BeforePhase; import org.apache.shale.tiger.register.FacesPhaseListener; @FacesPhaseListener(phaseId=PhaseId.RENDER_RESPONSE) public class MyPhaseListener { ... @BeforePhase public void myBeforePhase(PhaseEvent event) { ... } ... @AfterPhase public void myAfterPhase(PhaseEvent event) { ... } ... }
To declare a JavaServer Faces Renderer
class:
import javax.faces.render.Renderer; import org.apache.shale.tiger.register.FacesRenderer; @FacesRenderer(renderKitId="myRenderKitId" rendererType="myRendererType" componentFamily="javax.faces.Input") public class MyRenderer implements Renderer { ... }
If the renderKitId
attribute is not specified, the
Renderer
will be registered in the default HTML Basic
RenderKit
.
API STATUS: Experimental.
IMPLEMENTATION STATUS: Implemented, only lightly tested.
@since 1.0.1