com.sun.beans.decoder
public class: StringElementHandler [javadoc |
source]
java.lang.Object
com.sun.beans.decoder.ElementHandler
com.sun.beans.decoder.StringElementHandler
Direct Known Subclasses:
FloatElementHandler, LongElementHandler, ShortElementHandler, DoubleElementHandler, BooleanElementHandler, ByteElementHandler, IntElementHandler, ClassElementHandler, CharElementHandler
This class is intended to handle <string> element.
This element specifies
String values.
The result value is created from text of the body of this element.
For example:
<string>description</string>
is equivalent to {@code "description"} in Java code.
The value of inner element is calculated
before adding to the string using
String#valueOf(Object) .
Note that all characters are used including whitespaces (' ', '\t', '\n', '\r').
So the value of the element
<string><true></string>
is not equal to the value of the element
<string>
<true>
</string>
The following atribute is supported:
- id
- the identifier of the variable that is intended to store the result
- since:
1.7
-
- author:
Sergey
- A. Malenkov
Methods from com.sun.beans.decoder.ElementHandler: |
---|
addArgument, addAttribute, addCharacter, endElement, getContextBean, getOwner, getParent, getValueObject, getVariable, isArgument, setOwner, setParent, startElement |
Methods from java.lang.Object: |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method from com.sun.beans.decoder.StringElementHandler Detail: |
protected final void addArgument(Object argument) {
if (this.sb == null) {
throw new IllegalStateException("Could not add argument to evaluated string element");
}
this.sb.append(argument);
}
Adds the string value of the argument to the string value of this element. |
public final void addCharacter(char ch) {
if (this.sb == null) {
throw new IllegalStateException("Could not add chararcter to evaluated string element");
}
this.sb.append(ch);
}
Adds the character that contained in this element. |
protected Object getValue(String argument) {
return argument;
}
Returns the text of the body of this element.
This method evaluates value from text of the body,
and should be overridden in those handlers
that extend behavior of this element. |
protected final ValueObject getValueObject() {
if (this.sb != null) {
try {
this.value = ValueObjectImpl.create(getValue(this.sb.toString()));
}
catch (RuntimeException exception) {
getOwner().handleException(exception);
}
finally {
this.sb = null;
}
}
return this.value;
}
Returns the value of this element. |