org.pietschy.command
Class AbstractBuilder
java.lang.Object
org.pietschy.command.AbstractBuilder
public class AbstractBuilder
extends java.lang.Object
Provides common methods required by all builders.
getAttribute
protected String getAttribute(Element element,
String attributeName)
Gets an attribute from an element. If the attribute is prefixed with Names.I18N_ATTRIBUTE_PREFIX
then
this method will attempt to load the attribute from the resource bundle. This method returns null if
the the requested attribute isn't present.
element
- the element constaining the attributeattributeName
- the attribute name
- the attribute value, or null if the attribute doesn't exist.
getCommandManager
public CommandManager getCommandManager()
Gets the associated
CommandManager
for the builder to use as required. This will be
configured when the builder is installed. The
CommandManager
is typically used to gain access the the class loader and resource bundle.
getElementPath
public String getElementPath(Element element)
Returns a string representing the elements position in the command heirarchy. This method is only intended
to produce debug information.
element
- the element to examine.
- a string representing the elements posistion in the configuration heirarchy.
getElementText
protected String getElementText(Element element)
Gets the textural value of an element. If the element has Names.I18N_ATTRIBUTE
then
this method will attempt to load the value from the resource bundle.
element
- the element whose text value is to be extracted.
- the text value of the element
isEmptyElement
protected boolean isEmptyElement(Element element)
Checks if the specified element is empty. Emply elements are those that have no children (not
even an empty text node). A empty node is specified in the form <text/>. Empty
nodes are used to signify that a particular face element is null and that it shouldn't inherit
from its parent.
element
- the element to check.
- true if the element has no children and no attributes, false otherwise.
isIncluded
protected boolean isIncluded(Element e)
Tests if the specified element has been conditionally included.
This method will always return
true
if there is no
include-if element. If present, this method will evaulate the exprerssion using
ConditionEvaluator.evaluate(String)
returning the result.
e
- the element that may or may not have a include-if attriubte.
- false if and only if there is an include-if attribute and the
expression evaluates to false.
populateProperties
protected void populateProperties(Command command,
Element commandRoot)
setCommandManager
public void setCommandManager(CommandManager commandManager)
Sets the associated
CommandManager
for the builder to use as required. This will be
configured when the builder is installed. The
CommandManager
is typically used to gain access the the class loader and resource bundle.