Class 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 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!)
    • 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 class TypedAttribute<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 value null means "absent" for #IMPLIED attributes and passes the test.
        Specified by:
        checkValue in class TypedAttribute<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. Maps NumberFormatException to IllegalArgumentException.
        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. Maps NumberFormatException to IllegalArgumentException.
        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 class TypedAttribute<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.