org.hl7.meta
Class Cardinality

java.lang.Object
  extended by org.hl7.meta.Cardinality

public class Cardinality
extends java.lang.Object

A flyweight implementation for cardinalities of HL7 v3 attributes and associations.

Author:
Skirmantas Kligys (skirmis@hotmail.com)

Field Summary
static int UNBOUNDED
           
 
Method Summary
static Cardinality create(java.lang.String s)
          Looks up cardinality by its string representation.
 int getMax()
          Gets the maximum cardinality.
 int getMin()
          Gets the minimum cardinality.
 java.lang.String toString()
          Converts cardinality to its string representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNBOUNDED

public static final int UNBOUNDED
See Also:
Constant Field Values
Method Detail

create

public static Cardinality create(java.lang.String s)
Looks up cardinality by its string representation.

Parameters:
s - the string to look up
Throws:
java.lang.IllegalArgumentException - if the string cannot be looked up

getMin

public int getMin()
Gets the minimum cardinality.

Returns:
the minimum

getMax

public int getMax()
Gets the maximum cardinality.

Returns:
the maximum; UNBOUNDED means "*". UNBOUNDED happens to be the Integer.MAX_VALUE, but who will ever distinguish cardinalities of that magnitude. Noone will.

toString

public java.lang.String toString()
Converts cardinality to its string representation.

Overrides:
toString in class java.lang.Object
Returns:
the string representation
Throws:
java.lang.IllegalArgumentException - on internal error