|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.raritantechnologies.utils.AttributeUtils
| Method Summary | |
static boolean |
checkBooleanAttribute(org.w3c.dom.Element elem,
java.lang.String attrib,
java.lang.String defaultString,
boolean defaultValue)
Tests a DOM element for the presence of an attribute, and sets a boolean flag based on its presence and string value (if any). |
static int |
checkIntValue(org.w3c.dom.Element elem,
java.lang.String attrib,
int defaultInt)
|
static java.lang.String |
checkStringAttribute(org.w3c.dom.Element elem,
java.lang.String attrib,
java.lang.String defaultValue)
|
static AttributeUtils |
getInstance()
Gets the unique instance of this class. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static final AttributeUtils getInstance()
public static boolean checkBooleanAttribute(org.w3c.dom.Element elem,
java.lang.String attrib,
java.lang.String defaultString,
boolean defaultValue)
Tests a DOM element for the presence of an attribute, and sets a boolean flag based on its presence and string value (if any). Example:
boolean myFlag = DOMUtils.checkBooleanAttribute(tagElement,
"myFlagAttrib", "true", true);
will set myFlag to true if (and only if) a myFlagAttrib attribute is
present on the tag and has the string value "true"; otherwise, myFlag
will be false
Note: These use cases will illustrate the method's behavior:
defaultValue will be returned.defaultString, the boolean value specified in the defaultValue will be returned.defaultString, the boolean opposite of the defaultValue (ie., !defaultValue) will be returned.checkBooleanAttribute will return its defaultValue if the attribute is present
and contains any value other than the defaultString.
elem - - The DOM element containing the tag to be inspected.attrib - - The DOM element attribute that determines the value.defaultString - - The String reprentation of the default value.defaultValue - - The boolean value to return if the default case is selected.
public static java.lang.String checkStringAttribute(org.w3c.dom.Element elem,
java.lang.String attrib,
java.lang.String defaultValue)
elem - attrib - defaultValue -
public static int checkIntValue(org.w3c.dom.Element elem,
java.lang.String attrib,
int defaultInt)
elem - attrib - defaultInt -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||