Package eu.bandm.tools.tdom.runtime
Class SelectedIntegersAttribute
java.lang.Object
eu.bandm.tools.tdom.runtime.TypedNode<TypedExtension>
eu.bandm.tools.tdom.runtime.TypedAttribute<Integer>
eu.bandm.tools.tdom.runtime.SelectedIntegersAttribute
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 an EnumerationAttribute.
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.SafeValuesNested 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
ConstructorsModifierConstructorDescriptionprotectedprotectedSelectedIntegersAttribute(@Opt Integer value) protectedSelectedIntegersAttribute(@Opt String value) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCheck routine for the validity of the attributes' intended value.(package private) final voiddecode(DecodingInputStream in, TypedExtension ext) DOCMEfinal voidencode(EncodingOutputStream out, TypedExtension ext) DOCMEintgetMax()DOCMEintgetMin()DOCMEfinal StringReturns the textual representation of a possible attribute value (not null), as it would be contained literally in a possible XML text representation.The definition text for the "type" of the attribute in the original DTD.DOCMEbooleanisValid(int i) DOCMEstatic intAux Method for parsing an integer to the base 10.static intAux Method for parsing an integer to a given base.Methods inherited from class eu.bandm.tools.tdom.runtime.TypedAttribute
assertSetAttrValid, assertSetAttrValid, checkRequired, clearValue, find, find, getDefaultValue, getLocalName, getNamespaceName, getNamespaceURI, getStringValue, getTagName, getValue, isFixed, isOptional, isRequired, isSpecified, makeUnspecified, put, setValueMethods 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 Details
-
SelectedIntegersAttribute
protected SelectedIntegersAttribute() -
SelectedIntegersAttribute
- Throws:
TdomAttributeSyntaxException
-
SelectedIntegersAttribute
- Throws:
TdomAttributeSyntaxException
-
-
Method Details
-
getTypeString
The definition text for the "type" of the attribute in the original DTD.- Specified by:
getTypeStringin classTypedAttribute<Integer>
-
isValid
public boolean isValid(int i) DOCME -
getValidInts
DOCME -
getMin
public int getMin()DOCME -
getMax
public int getMax()DOCME -
checkValue
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 theTypedAttribute.setValue(V)method. The valuenullmeans "absent" for#IMPLIEDattributes and passes the test.- Specified by:
checkValuein classTypedAttribute<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
Aux Method for parsing an integer to a given base. MapsNumberFormatExceptiontoIllegalArgumentException.- Throws:
IllegalArgumentException
-
parse
Aux Method for parsing an integer to the base 10. MapsNumberFormatExceptiontoIllegalArgumentException.- Throws:
IllegalArgumentException
-
getStringValue
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:
getStringValuein classTypedAttribute<Integer>- Returns:
- (never null) the textual representation of this attribute value, as it would be contained literally in a possible XML text representation.
-
encode
DOCME- Specified by:
encodein classTypedNode<TypedExtension>- Throws:
IOException
-
decode
final void decode(DecodingInputStream in, TypedExtension ext) throws IOException, TdomAttributeSyntaxException DOCME- Specified by:
decodein classTypedAttribute<Integer>- Throws:
IOExceptionTdomAttributeSyntaxException
-