Package org.jibx.schema.types
Class Count
java.lang.Object
org.jibx.schema.types.Count
Repetition count in a schema definition.
- Author:
- Dennis M. Sosnoski
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Count
getBoundedCount
(String value) Deserializer method for bounded values.int
getCount()
Get count value.static Count
Deserializer method.static boolean
isCountEqual
(int value, Count count) Check if a count attribute is equal to a specified value.boolean
isEqual
(int value) Check for count equal to a particular value.boolean
isGreaterThan
(int value) Check for count greater than a particular value.boolean
Check for unbounded count.toString()
Conversion to text form.
-
Field Details
-
COUNT_ZERO
Predefined count of '0'. -
COUNT_ONE
Predefined count of '1'. -
COUNT_UNBOUNDED
Predefined count of 'unbounded'. -
m_count
private final int m_countActual count for bounded value. -
m_unbounded
private final boolean m_unboundedFlag for unbounded value.
-
-
Constructor Details
-
Count
private Count(int count, boolean unbounded) Internal constructor.- Parameters:
count
-unbounded
-
-
-
Method Details
-
getCount
public int getCount()Get count value. This method throws an exception if used with an unbounded value, so always tryisUnbounded()
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
-- 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
-- Returns:
- greater than flag
-
getBoundedCount
Deserializer method for bounded values.- Parameters:
value
- text representation- Returns:
- instance of class
- Throws:
JiBXException
- on conversion error
-
getCount
Deserializer method.- Parameters:
value
- text representation- Returns:
- instance of class (
null
if none) - Throws:
JiBXException
- on conversion error
-
isCountEqual
Check if a count attribute is equal to a specified value. If the count isnull
, the value is taken as '1'.- Parameters:
value
-count
-- Returns:
true
if value equal,false
if not
-
toString
Conversion to text form.
-