Package eu.bandm.tools.tdom.runtime
Class TypedNode<X extends TypedExtension>
- java.lang.Object
-
- eu.bandm.tools.tdom.runtime.TypedNode<X>
-
- Direct Known Subclasses:
TypedAttribute
,TypedDocument
,TypedEthereal
,TypedSubstantial
,TypedSubtree
public abstract class TypedNode<X extends TypedExtension> extends java.lang.Object
Fundamental superclass for all classes which implement tdom components. Additionally contains some static retrieval methods.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
TypedNode.ParseListener<E extends TypedElement<?,?>>
Listener interface which may be registered with the tdom generated parsing code and will be called after each successful parsing step.
-
Constructor Summary
Constructors Modifier Constructor Description protected
TypedNode()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static @Opt java.math.BigDecimal
asBigDecimal(@Opt CDataAttribute att)
Returns the value of its argument as a decimal encoded BigDecimal value.static @Opt java.math.BigDecimal
asBigDecimal(@Opt NmTokenAttribute att)
Returns the value of its argument as a decimal encoded BigDecimal value.static @Opt java.math.BigDecimal
asBigDecimal(@Opt java.lang.String s)
Returns the value of its argument as a decimal encoded BigDecimal value.static @Opt java.math.BigDecimal
asBigDecimal(TypedElement.PCDataContainer el)
Returns the contents of its argument as a decimal encoded BigDecimal value.static @Opt java.math.BigInteger
asBigInteger(@Opt CDataAttribute att)
Returns the value of its argument as a decimal encoded BigInteger value.static @Opt java.math.BigInteger
asBigInteger(@Opt NmTokenAttribute att)
Returns the value of its argument as a decimal encoded BigInteger value.static @Opt java.math.BigInteger
asBigInteger(@Opt java.lang.String s)
Returns the value of its argument as a decimal encoded BigInteger value.static @Opt java.math.BigInteger
asBigInteger(TypedElement.PCDataContainer el)
Returns the contents of its argument as a decimal encoded BigInteger value.static <V extends java.lang.Enum<V> & EnumerationValue>
booleanasBoolean(EnumerationAttribute<V> att, V value)
Returns whether the contents of an attribute is equal to one particular typed attribute value.static <V> boolean
asBoolean(TypedAttribute<java.lang.String> att, java.lang.String value)
static @Opt java.lang.Double
asDouble(@Opt CDataAttribute att)
Returns the value of its argument as a decimal encoded double value.static @Opt java.lang.Double
asDouble(@Opt NmTokenAttribute att)
Returns the value of its argument as a decimal encoded double value.static @Opt java.lang.Double
asDouble(@Opt java.lang.String s)
Returns the value of its argument as a decimal encoded double value.static @Opt java.lang.Double
asDouble(TypedElement.PCDataContainer el)
Returns the contents of its argument as a decimal encoded double value.static @Opt java.lang.Float
asFloat(@Opt CDataAttribute att)
Returns the value of its argument as a decimal encoded float value.static @Opt java.lang.Float
asFloat(@Opt NmTokenAttribute att)
Returns the value of its argument as a decimal encoded float value.static @Opt java.lang.Float
asFloat(@Opt java.lang.String s)
Returns the value of its argument as a decimal encoded float value.static @Opt java.lang.Float
asFloat(TypedElement.PCDataContainer el)
Returns the contents of its argument as a decimal encoded float value.static @Opt java.lang.Integer
asHexInt(@Opt CDataAttribute att)
Returns the value of its argument as a hexdecimal encoded integer value.static @Opt java.lang.Integer
asHexInt(@Opt NmTokenAttribute att)
Returns the value of its argument as a hexdecimal encoded integer value.static @Opt java.lang.Integer
asHexInt(@Opt java.lang.String s)
Returns the value of its argument as a hexdecimal encoded integer value.static @Opt java.lang.Integer
asHexInt(TypedElement.PCDataContainer el)
Returns the contents of its argument as a hexdecimal encoded integer value.static @Opt java.lang.Integer
asInt(@Opt CDataAttribute att)
Returns the value of its argument as a decimal encoded integer value.static @Opt java.lang.Integer
asInt(@Opt NmTokenAttribute att)
Returns the value of its argument as a decimal encoded integer value.static @Opt java.lang.Integer
asInt(@Opt java.lang.String s)
Returns the value of its argument as a decimal encoded integer value.static @Opt java.lang.Integer
asInt(TypedElement.PCDataContainer el)
Returns the contents of its argument as a decimal encoded integer value.static @Opt java.lang.Long
asLong(@Opt CDataAttribute att)
Returns the value of its argument as a decimal encoded long value.static @Opt java.lang.Long
asLong(@Opt NmTokenAttribute att)
Returns the value of its argument as a decimal encoded long value.static @Opt java.lang.Long
asLong(@Opt java.lang.String s)
Returns the value of its argument as a decimal encoded long value.static @Opt java.lang.Long
asLong(TypedElement.PCDataContainer el)
Returns the contents of its argument as a decimal encoded long value.static @Opt java.lang.String
asTrimmedString(@Opt CDataAttribute att)
Returns the contents of its argument as a trimmed string.static @Opt java.lang.String
asTrimmedString(@Opt NmTokenAttribute att)
Returns the contents of its argument as a trimmed string.static @Opt java.lang.String
asTrimmedString(@Opt java.lang.String s)
Returns its argument as a trimmed string.static java.lang.String
asTrimmedString(TypedElement.PCDataContainer el)
Returns the contents of its argument as a trimmed string.protected static <T> CheckedListPlus<T>
checkPlus(java.lang.String name, CheckedListPlus<T> arg)
protected static <T> T[]
checkPlus(java.lang.String name, T[] arg)
(internal use only) bttodoprotected static <T> CheckedList<T>
checkStar(java.lang.String name, CheckedList<T> arg)
protected static <T> T[]
checkStar(java.lang.String name, T[] arg)
protected static <T> T
checkStrict(java.lang.String name, T arg)
void
encode(boolean asAbstract, EncodingOutputStream out, X ext)
abstract void
encode(EncodingOutputStream out, X ext)
Abstract fall-back method which MUST be overridden and always throws an Exception.protected static <E extends TypedExtension>
voidencodeOptional(boolean asAbstract, TypedNode<E> node, EncodingOutputStream out, E ext)
protected static <E extends TypedExtension>
voidencodePlus(boolean asAbstract, CheckedListPlus<? extends TypedNode<E>> nodes, EncodingOutputStream out, E ext)
protected static <E extends TypedExtension>
voidencodePlus(boolean asAbstract, TypedNode<E>[] nodes, EncodingOutputStream out, E ext)
protected static <E extends TypedExtension>
voidencodeStar(boolean asAbstract, TypedNode<E>[] nodes, EncodingOutputStream out, E ext)
protected static <E extends TypedExtension>
voidencodeStar(boolean asAbstract, CheckedList<? extends TypedNode<E>> nodes, EncodingOutputStream out, E ext)
protected static java.util.List<TypedEthereal>
extractEthereals(SAXEventStream sev)
@Opt Location<XMLDocumentIdentifier>
getLocation()
Return the location in the original text document.protected static java.lang.String
getPCData(org.w3c.dom.NodeList nodes)
Gets the pc data content of a W3C DOM.void
setLocation(@Opt Locatable<XMLDocumentIdentifier> loc)
Set the location information.void
setLocation(@Opt Location<XMLDocumentIdentifier> location)
Set the location information.protected void
setLocation(@Opt Location<XMLDocumentIdentifier> begin, @Opt Location<XMLDocumentIdentifier> end)
Set the location information to an interval, if both limits are not null.
-
-
-
Method Detail
-
getLocation
@Opt public final @Opt Location<XMLDocumentIdentifier> getLocation()
Return the location in the original text document.- Returns:
- (maybe null) the location, if known.
-
setLocation
public final void setLocation(@Opt @Opt Location<XMLDocumentIdentifier> location)
Set the location information.- Parameters:
location
- (maybe null) the new location. Old location is overwritten, even wehn param is null.
-
setLocation
public final void setLocation(@Opt @Opt Locatable<XMLDocumentIdentifier> loc)
Set the location information.- Parameters:
loc
- (maybe null) the new location.
-
setLocation
protected final void setLocation(@Opt @Opt Location<XMLDocumentIdentifier> begin, @Opt @Opt Location<XMLDocumentIdentifier> end)
Set the location information to an interval, if both limits are not null. Otherwise to one of them which is not null, otherwise to null. Is called from generated code, operating on unknown SAX event sources, therefore incomplete location info may arrive here. SeeLocation.region(Location,Location)
for details of error processing, etc.- Parameters:
begin
- begin of location regionend
- end of location region
-
asBoolean
public static <V extends java.lang.Enum<V> & EnumerationValue> boolean asBoolean(EnumerationAttribute<V> att, V value)
Returns whether the contents of an attribute is equal to one particular typed attribute value. This can be used to decode false/true information, as in----option.dtd:---- hexadecimalIntegers (yes|no) 'yes' ----Compiler.java:--- if (asBoolean(data0.readAttr_fragmentedLists(), Element_optionlist.Attr_fragmentedLists.Value.Value_yes))...
-
asBoolean
public static <V> boolean asBoolean(TypedAttribute<java.lang.String> att, java.lang.String value)
-
asTrimmedString
public static java.lang.String asTrimmedString(TypedElement.PCDataContainer el)
Returns the contents of its argument as a trimmed string. The interfaceTypedElement.PCDataContainer
is added to each generated model class if it represents an element with a content model which contains "PCDATA".- Parameters:
el
- (maybe null) a model element which contains PCDATA.- Returns:
- the string value, the concatenation of all PCDATA directly contained in the elemnt. Is ==null in case of null input or empty string.
-
asTrimmedString
@Opt public static @Opt java.lang.String asTrimmedString(@Opt @Opt NmTokenAttribute att)
Returns the contents of its argument as a trimmed string.- Parameters:
att
- (maybe null) an attribute object.- Returns:
- the string value, ==null in case of null input or empty string.
-
asTrimmedString
@Opt public static @Opt java.lang.String asTrimmedString(@Opt @Opt CDataAttribute att)
Returns the contents of its argument as a trimmed string.- Parameters:
att
- (maybe null) an attribute object.- Returns:
- the string value, ==null in case of null input or empty string.
-
asTrimmedString
@Opt public static @Opt java.lang.String asTrimmedString(@Opt @Opt java.lang.String s)
Returns its argument as a trimmed string.- Parameters:
s
- (maybe null) input string.- Returns:
- the string value, ==null in case of null input or empty string.
-
asInt
@Opt public static @Opt java.lang.Integer asInt(@Opt TypedElement.PCDataContainer el)
Returns the contents of its argument as a decimal encoded integer value. The interfaceTypedElement.PCDataContainer
is added to each generated model class if it represents an element with a content model which contains "PCDATA".- Returns:
- the Integer value, ==null in case of null input or empty string input or conversion error.
-
asInt
@Opt public static @Opt java.lang.Integer asInt(@Opt @Opt NmTokenAttribute att)
Returns the value of its argument as a decimal encoded integer value.- Returns:
- the Integer value, ==null in case of null input or empty string input or conversion error.
-
asInt
@Opt public static @Opt java.lang.Integer asInt(@Opt @Opt CDataAttribute att)
Returns the value of its argument as a decimal encoded integer value.- Returns:
- the Integer value, ==null in case of null input or empty string input or conversion error.
-
asInt
@Opt public static @Opt java.lang.Integer asInt(@Opt @Opt java.lang.String s)
Returns the value of its argument as a decimal encoded integer value.- Returns:
- the Integer value, ==null in case of null input or empty string input or conversion error.
-
asLong
@Opt public static @Opt java.lang.Long asLong(TypedElement.PCDataContainer el)
Returns the contents of its argument as a decimal encoded long value. The interfaceTypedElement.PCDataContainer
is added to each generated model class if it represents an element with a content model which contains "PCDATA".- Returns:
- the Long value, ==null in case of null input or empty string input or conversion error.
-
asLong
@Opt public static @Opt java.lang.Long asLong(@Opt @Opt NmTokenAttribute att)
Returns the value of its argument as a decimal encoded long value.- Returns:
- the Long value, ==null in case of null input or empty string input or conversion error.
-
asLong
@Opt public static @Opt java.lang.Long asLong(@Opt @Opt CDataAttribute att)
Returns the value of its argument as a decimal encoded long value.- Returns:
- the Long value, ==null in case of null input or empty string input or conversion error.
-
asLong
@Opt public static @Opt java.lang.Long asLong(@Opt @Opt java.lang.String s)
Returns the value of its argument as a decimal encoded long value.- Returns:
- the Long value, ==null in case of null input or empty string input or conversion error.
-
asFloat
@Opt public static @Opt java.lang.Float asFloat(@Opt TypedElement.PCDataContainer el)
Returns the contents of its argument as a decimal encoded float value. The interfaceTypedElement.PCDataContainer
is added to each generated model class if it represents an element with a content model which contains "PCDATA".- Returns:
- the Float value, ==null in case of null input or empty string input or conversion error.
-
asFloat
@Opt public static @Opt java.lang.Float asFloat(@Opt @Opt NmTokenAttribute att)
Returns the value of its argument as a decimal encoded float value.- Returns:
- the Float value, ==null in case of null input or empty string input or conversion error.
-
asFloat
@Opt public static @Opt java.lang.Float asFloat(@Opt @Opt CDataAttribute att)
Returns the value of its argument as a decimal encoded float value.- Returns:
- the Float value, ==null in case of null input or empty string input or conversion error.
-
asFloat
@Opt public static @Opt java.lang.Float asFloat(@Opt @Opt java.lang.String s)
Returns the value of its argument as a decimal encoded float value.- Returns:
- the Float value, ==null in case of null input or empty string input or conversion error.
-
asDouble
@Opt public static @Opt java.lang.Double asDouble(TypedElement.PCDataContainer el)
Returns the contents of its argument as a decimal encoded double value. The interfaceTypedElement.PCDataContainer
is added to each generated model class if it represents an element with a content model which contains "PCDATA".- Returns:
- the Double value, ==null in case of null input or empty string input or conversion error.
-
asDouble
@Opt public static @Opt java.lang.Double asDouble(@Opt @Opt NmTokenAttribute att)
Returns the value of its argument as a decimal encoded double value.- Returns:
- the Double value, ==null in case of null input or empty string input or conversion error.
-
asDouble
@Opt public static @Opt java.lang.Double asDouble(@Opt @Opt CDataAttribute att)
Returns the value of its argument as a decimal encoded double value.- Returns:
- the Double value, ==null in case of null input or empty string input or conversion error.
-
asDouble
@Opt public static @Opt java.lang.Double asDouble(@Opt @Opt java.lang.String s)
Returns the value of its argument as a decimal encoded double value.- Returns:
- the Double value, ==null in case of null input or empty string input or conversion error.
-
asHexInt
@Opt public static @Opt java.lang.Integer asHexInt(@Opt TypedElement.PCDataContainer el)
Returns the contents of its argument as a hexdecimal encoded integer value. A prefix "0x
" or "0X
" MAY be present and is discarded, but is not required. The interfaceTypedElement.PCDataContainer
is added to each generated model class if it represents an element with a content model which contains "PCDATA".- Returns:
- the Integer value, ==null in case of null input or empty string input or conversion error.
-
asHexInt
@Opt public static @Opt java.lang.Integer asHexInt(@Opt @Opt NmTokenAttribute att)
Returns the value of its argument as a hexdecimal encoded integer value. A prefix "0x
" or "0X
" MAY be present and is discarded, but is not required.- Returns:
- the Integer value, ==null in case of null input or empty string input or conversion error.
-
asHexInt
@Opt public static @Opt java.lang.Integer asHexInt(@Opt @Opt CDataAttribute att)
Returns the value of its argument as a hexdecimal encoded integer value. A prefix "0x
" or "0X
" MAY be present and is discarded, but is not required.- Returns:
- the Integer value, ==null in case of null input or empty string input or conversion error.
-
asHexInt
@Opt public static @Opt java.lang.Integer asHexInt(@Opt @Opt java.lang.String s)
Returns the value of its argument as a hexdecimal encoded integer value. A prefix "0x
" or "0X
" MAY be present and is discarded, but is not required.- Returns:
- the Integer value, ==null in case of null input or empty string input or conversion error.
-
asBigInteger
@Opt public static @Opt java.math.BigInteger asBigInteger(TypedElement.PCDataContainer el)
Returns the contents of its argument as a decimal encoded BigInteger value. The interfaceTypedElement.PCDataContainer
is added to each generated model class if it represents an element with a content model which contains "PCDATA".- Returns:
- the BigInteger value, ==null in case of null input or empty string input or conversion error.
-
asBigInteger
@Opt public static @Opt java.math.BigInteger asBigInteger(@Opt @Opt NmTokenAttribute att)
Returns the value of its argument as a decimal encoded BigInteger value.- Returns:
- the BigInteger value, ==null in case of null input or empty string input or conversion error.
-
asBigInteger
@Opt public static @Opt java.math.BigInteger asBigInteger(@Opt @Opt CDataAttribute att)
Returns the value of its argument as a decimal encoded BigInteger value.- Returns:
- the BigInteger value, ==null in case of null input or empty string input or conversion error.
-
asBigInteger
@Opt public static @Opt java.math.BigInteger asBigInteger(@Opt @Opt java.lang.String s)
Returns the value of its argument as a decimal encoded BigInteger value.- Returns:
- the BigInteger value, ==null in case of null input or empty string input or conversion error.
-
asBigDecimal
@Opt public static @Opt java.math.BigDecimal asBigDecimal(TypedElement.PCDataContainer el)
Returns the contents of its argument as a decimal encoded BigDecimal value. The interfaceTypedElement.PCDataContainer
is added to each generated model class if it represents an element with a content model which contains "PCDATA".- Returns:
- the BigDecimal value, ==null in case of null input or empty string input or conversion error.
-
asBigDecimal
@Opt public static @Opt java.math.BigDecimal asBigDecimal(@Opt @Opt NmTokenAttribute att)
Returns the value of its argument as a decimal encoded BigDecimal value.- Returns:
- the BigDecimal value, ==null in case of null input or empty string input or conversion error.
-
asBigDecimal
@Opt public static @Opt java.math.BigDecimal asBigDecimal(@Opt @Opt CDataAttribute att)
Returns the value of its argument as a decimal encoded BigDecimal value.- Returns:
- the BigDecimal value, ==null in case of null input or empty string input or conversion error.
-
asBigDecimal
@Opt public static @Opt java.math.BigDecimal asBigDecimal(@Opt @Opt java.lang.String s)
Returns the value of its argument as a decimal encoded BigDecimal value.- Returns:
- the BigDecimal value, ==null in case of null input or empty string input or conversion error.
-
getPCData
protected static java.lang.String getPCData(org.w3c.dom.NodeList nodes)
Gets the pc data content of a W3C DOM. (IS NOT TDOM RELATED, aber HIER? FIXME )
-
extractEthereals
protected static java.util.List<TypedEthereal> extractEthereals(SAXEventStream sev)
-
encode
public abstract void encode(EncodingOutputStream out, X ext) throws java.io.IOException
Abstract fall-back method which MUST be overridden and always throws an Exception.- Throws:
java.io.IOException
-
encodeOptional
protected static <E extends TypedExtension> void encodeOptional(boolean asAbstract, TypedNode<E> node, EncodingOutputStream out, E ext) throws java.io.IOException
- Throws:
java.io.IOException
-
encodeStar
protected static <E extends TypedExtension> void encodeStar(boolean asAbstract, TypedNode<E>[] nodes, EncodingOutputStream out, E ext) throws java.io.IOException
- Throws:
java.io.IOException
-
encodeStar
protected static <E extends TypedExtension> void encodeStar(boolean asAbstract, CheckedList<? extends TypedNode<E>> nodes, EncodingOutputStream out, E ext) throws java.io.IOException
- Throws:
java.io.IOException
-
encodePlus
protected static <E extends TypedExtension> void encodePlus(boolean asAbstract, TypedNode<E>[] nodes, EncodingOutputStream out, E ext) throws java.io.IOException
- Throws:
java.io.IOException
-
encodePlus
protected static <E extends TypedExtension> void encodePlus(boolean asAbstract, CheckedListPlus<? extends TypedNode<E>> nodes, EncodingOutputStream out, E ext) throws java.io.IOException
- Throws:
java.io.IOException
-
encode
public void encode(boolean asAbstract, EncodingOutputStream out, X ext) throws java.io.IOException
- Throws:
java.io.IOException
-
checkStrict
protected static <T> T checkStrict(java.lang.String name, T arg)
-
checkStar
protected static <T> T[] checkStar(java.lang.String name, T[] arg)
-
checkStar
protected static <T> CheckedList<T> checkStar(java.lang.String name, CheckedList<T> arg)
-
checkPlus
protected static <T> T[] checkPlus(java.lang.String name, T[] arg)
(internal use only) bttodo
-
checkPlus
protected static <T> CheckedListPlus<T> checkPlus(java.lang.String name, CheckedListPlus<T> arg)
-
-