JBoss.orgCommunity Documentation

Chapter 10. Naming conventions

During the development process, the next naming convention for all project stuff should be mentioned.

At first take a look at the definitions that are used in this structure. Uppercase symbols means Java names notation. For name "foo" <name> means "foo", and <Name> - "Foo":

Table 10.1. The structure definitions

DefinitionDescription
<prefix> A common library name for example, base JSF components use <javax.faces> prefix. The value for prefix get from an abstract component package or a renderer template path.
<name> A name for a base component. For UIInput component <name> is "input". The value for a component name generator could be obtained from UI or Abstract class name.
<markup> A render-kit generated content name: "html" for HTML/XHTML pages, "wml" for mobile content, etc. It should be provided in the render-kit description by Ant task or in Maven's POM. By default, "html" is used.
<rendererName> A name of the renderer for concreting a visual component implementation, e.g. "commandButton" , "panelGroup", etc. A generator can take <rendererName> from a template file name.
<event> A name for a Faces Event: "action" for all ActionSource components like UICommand. It could be provided in the component configuration, or obtain from the implemented source interface.

Now let's take a look to the naming convention. By default, a generator expects the written Java classes structure above:

Table 10.2. The Java classes structure

Naming conventionDescription
<prefix>.component.Abstract<Name> An optional abstract super-class for a JSF component. In order to avoid manual writing for EL-enabled getters/setters, saveState/restoreState methods, listener-related methods etc., you can create an abstract class, and a generator creates the implementation.
<prefix>.component.UIt<Name> A Base component class. It can be generated from the abstract superclass or created by a developer.
<prefix>.component.<markup>.<Markup><RendererName> A renderer-specific generated component. The <Markup> is a render-kit specific generation name such as html, xml, wml. In addition to the UI Component class, this class contains Java Bean getter/setter methods for renderer-specific attributes. This class is generated by CDK.
<prefix>.t<Name> A JSF UI component type. Can be provided in the configuration or calculated from a component class name.
<prefix>.<Markup><RendererName> A renderer-specific JSF component type. Can be provided in the configuration or calculated from the renderer name.
<prefix>.renderkit.<RendererName>RendererBase A Renderer Base class is an optional Renderer superclass, implements methods from the template renderer. Should be created by you.
<prefix>.renderkit.<markup><RendererName> A generated Renderer
<prefix>.<RendererName> A JSF renderer type. Can be provided in the configuration or calculated from a renderer name.
<prefix>.<Markup><RendererName>.xml A template for generating the renderer class. JSPX syntax is used. Should be provided by you.
<prefix>.taglib.<RendererName>Tag A JSP tag class
<prefix>.taglib.<RendererName>TagHandler A Facelets Tag Handler class.
<RendererName> A JSP/Facelets Tag name

Here is the Java classes structure for the components, that uses JSF events:

Table 10.3. The Java classes structure for components, that uses JSF events

Naming conventionDescription
<prefix>.event.<Event>Event An event class, that you should provide.
<prefix>.event.<Event>Listener An event listener interface,that could be generated by CDK
<prefix>.event.<Event>Source An interface for an event processing component, that includes the following methods: add<Event>Listener(<Event>Listener listener ), remove<Event>Listener(<Event>Listener listener )
<prefix>.event.<Event>EventWrapper A wrapper class, that is used for binding listener's EL-expression in user's beans.
<prefix>.taglib.<Event>ListenerTag A JSP tag class for a creating listener instance. A parent tag must creates component implementing Source interface.
<prefix>.taglib.<Event>ListenerTagHandler A Facelets tag class for creation of listener instance.