Class Count


  • public class Count
    extends Object
    Repetition count in a schema definition.
    Author:
    Dennis M. Sosnoski
    • Field Detail

      • COUNT_ZERO

        public static final Count COUNT_ZERO
        Predefined count of '0'.
      • COUNT_ONE

        public static final Count COUNT_ONE
        Predefined count of '1'.
      • COUNT_UNBOUNDED

        public static final Count COUNT_UNBOUNDED
        Predefined count of 'unbounded'.
    • Method Detail

      • getCount

        public int getCount()
        Get count value. This method throws an exception if used with an unbounded value, so always try isUnbounded() first.
        Returns:
        count
      • isUnbounded

        public boolean isUnbounded()
        Check for unbounded count.
        Returns:
        unbounded flag
      • isEqual

        public boolean isEqual​(int value)
        Check for count equal to a particular value. This is a convenience method which avoids the need to separately check unbounded and then compare the count.
        Parameters:
        value - to check
        Returns:
        equal flag
      • isGreaterThan

        public boolean isGreaterThan​(int value)
        Check for count greater than a particular value. This is a convenience method which avoids the need to separately check unbounded and then compare the count.
        Parameters:
        value - to check
        Returns:
        greater than flag
      • getBoundedCount

        public static Count getBoundedCount​(String value)
                                     throws org.jibx.runtime.JiBXException
        Deserializer method for bounded values.
        Parameters:
        value - text representation
        Returns:
        instance of class
        Throws:
        org.jibx.runtime.JiBXException - on conversion error
      • getCount

        public static Count getCount​(String value)
                              throws org.jibx.runtime.JiBXException
        Deserializer method.
        Parameters:
        value - text representation
        Returns:
        instance of class (null if none)
        Throws:
        org.jibx.runtime.JiBXException - on conversion error
      • isCountEqual

        public static boolean isCountEqual​(int value,
                                           Count count)
        Check if a count attribute is equal to a specified value. If the count is null, the value is taken as '1'.
        Parameters:
        value - to check
        count - times
        Returns:
        true if value equal, false if not
      • toString

        public String toString()
        Conversion to text form.
        Overrides:
        toString in class Object
        Returns:
        count as text