Package eu.bandm.tools.tdom.runtime
Class SelectedIntegersAttribute
- java.lang.Object
-
- eu.bandm.tools.tdom.runtime.TypedNode<TypedExtension>
-
- eu.bandm.tools.tdom.runtime.TypedAttribute<java.lang.Integer>
-
- eu.bandm.tools.tdom.runtime.SelectedIntegersAttribute
-
public abstract class SelectedIntegersAttribute extends TypedAttribute<java.lang.Integer>
Base class for all generated classes which realize an Attribute with a type which is defined as a disjunction of integer values, like<!ATTLIST element f (1 | 2 | 4 | 8 | 16 | -7) #IMPLIED >
Normally this is realized as anEnumerationAttribute
. But this requires an Enumeration Type, and double conversions (item type to string to integer, and backwards). So with the PI<?tdom selectedIntegers element@f ?> -- or in case of common attributes: <?tdom selectedIntegers @f ?>
.. this class can explicitly be chosen as a more convenient implementation. (This explicitness is required for backward and forward compatibility!)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class eu.bandm.tools.tdom.runtime.TypedAttribute
TypedAttribute.__PreAtts, TypedAttribute.SafeValues
-
Nested classes/interfaces inherited from class eu.bandm.tools.tdom.runtime.TypedNode
TypedNode.ParseListener<E extends TypedElement<?,?>>
-
-
Field Summary
-
Fields inherited from class eu.bandm.tools.tdom.runtime.TypedAttribute
__preAtts, emptyAttributes, mutable, safeValues, specified, value
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SelectedIntegersAttribute()
protected
SelectedIntegersAttribute(@Opt java.lang.Integer value)
protected
SelectedIntegersAttribute(@Opt java.lang.String value)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
checkValue(java.lang.Integer i)
Check routine for the validity of the attributes' intended value.(package private) void
decode(DecodingInputStream in, TypedExtension ext)
DOCMEvoid
encode(EncodingOutputStream out, TypedExtension ext)
DOCMEint
getMax()
DOCMEint
getMin()
DOCMEjava.lang.String
getStringValue(java.lang.Integer v)
Returns the textual representation of a possible attribute value (not null), as it would be contained literally in a possible XML text representation.java.lang.String
getTypeString()
The definition text for the "type" of the attribute in the original DTD.abstract java.util.SortedSet<java.lang.Integer>
getValidInts()
DOCMEboolean
isValid(int i)
DOCMEstatic int
parse(java.lang.String vs)
Aux Method for parsing an integer to the base 10.static int
parse(java.lang.String vs, int base)
Aux Method for parsing an integer to a given base.-
Methods inherited from class eu.bandm.tools.tdom.runtime.TypedAttribute
assertSetAttrValid, checkRequired, clearValue, find, find, getDefaultValue, getLocalName, getNamespaceName, getNamespaceURI, getStringValue, getTagName, getValue, isFixed, isOptional, isRequired, isSpecified, makeUnspecified, put, setValue
-
Methods inherited from class eu.bandm.tools.tdom.runtime.TypedNode
asBigDecimal, asBigDecimal, asBigDecimal, asBigDecimal, asBigInteger, asBigInteger, asBigInteger, asBigInteger, asBoolean, asBoolean, asDouble, asDouble, asDouble, asDouble, asFloat, asFloat, asFloat, asFloat, asHexInt, asHexInt, asHexInt, asHexInt, asInt, asInt, asInt, asInt, asLong, asLong, asLong, asLong, asTrimmedString, asTrimmedString, asTrimmedString, asTrimmedString, checkPlus, checkPlus, checkStar, checkStar, checkStrict, encode, encodeOptional, encodePlus, encodePlus, encodeStar, encodeStar, extractEthereals, getLocation, getPCData, setLocation, setLocation, setLocation
-
-
-
-
Constructor Detail
-
SelectedIntegersAttribute
protected SelectedIntegersAttribute()
-
SelectedIntegersAttribute
protected SelectedIntegersAttribute(@Opt @Opt java.lang.Integer value) throws TdomAttributeSyntaxException
- Throws:
TdomAttributeSyntaxException
-
SelectedIntegersAttribute
protected SelectedIntegersAttribute(@Opt @Opt java.lang.String value) throws TdomAttributeSyntaxException
- Throws:
TdomAttributeSyntaxException
-
-
Method Detail
-
getTypeString
public java.lang.String getTypeString()
Description copied from class:TypedAttribute
The definition text for the "type" of the attribute in the original DTD.- Specified by:
getTypeString
in classTypedAttribute<java.lang.Integer>
-
isValid
public boolean isValid(int i)
DOCME
-
getValidInts
public abstract java.util.SortedSet<java.lang.Integer> getValidInts()
DOCME
-
getMin
public int getMin()
DOCME
-
getMax
public int getMax()
DOCME
-
checkValue
protected void checkValue(java.lang.Integer i) throws TdomAttributeSyntaxException
Description copied from class:TypedAttribute
Check routine for the validity of the attributes' intended value. Is a call-back, implemented by the sub-classes. Is called only here, by two constructors and the#set_value(V)
method. The valuenull
means "absent" for#IMPLIED
attributes and passes the test.- Specified by:
checkValue
in classTypedAttribute<java.lang.Integer>
- Parameters:
i
- the value to test; maybe null.- Throws:
TdomAttributeSyntaxException
- iff the value does not match the type of the XML attribute, including a forbidden Null.
-
parse
public static int parse(java.lang.String vs, int base) throws java.lang.IllegalArgumentException
Aux Method for parsing an integer to a given base. MapsNumberFormatException
toIllegalArgumentException
.- Throws:
java.lang.IllegalArgumentException
-
parse
public static int parse(java.lang.String vs) throws java.lang.IllegalArgumentException
Aux Method for parsing an integer to the base 10. MapsNumberFormatException
toIllegalArgumentException
.- Throws:
java.lang.IllegalArgumentException
-
getStringValue
public final java.lang.String getStringValue(java.lang.Integer v)
Description copied from class:TypedAttribute
Returns the textual representation of a possible attribute value (not null), as it would be contained literally in a possible XML text representation. Since the textual representation of a String is the string itself, this method is relevant for enumeration types only (Later: also for "entity" types, but these are not yet supported.)- Specified by:
getStringValue
in classTypedAttribute<java.lang.Integer>
- Returns:
- (never null) the textual representation of this attribute value, as it would be contained literally in a possible XML text representation.
-
encode
public final void encode(EncodingOutputStream out, TypedExtension ext) throws java.io.IOException
DOCME- Specified by:
encode
in classTypedNode<TypedExtension>
- Throws:
java.io.IOException
-
decode
final void decode(DecodingInputStream in, TypedExtension ext) throws java.io.IOException, TdomAttributeSyntaxException
DOCME- Specified by:
decode
in classTypedAttribute<java.lang.Integer>
- Throws:
java.io.IOException
TdomAttributeSyntaxException
-
-