Humboldt Alignment Editor 2.5.0

eu.esdihumboldt.hale.common.schema.model.constraint.property
Class Cardinality

java.lang.Object
  extended by eu.esdihumboldt.hale.common.schema.model.constraint.property.Cardinality
All Implemented Interfaces:
GroupPropertyConstraint, PropertyConstraint

@Immutable
public class Cardinality
extends Object
implements GroupPropertyConstraint, PropertyConstraint

Specifies the cardinality for a property, default is for a property to occur exactly once.

Author:
Simon Templer

Field Summary
static Cardinality CC_ANY_NUMBER
          Cardinality constraint for properties that occur in any number (zero to infinity)
static Cardinality CC_AT_LEAST_ONCE
          Cardinality constraint for properties that occur at least once (one to infinity)
static Cardinality CC_EXACTLY_ONCE
          Cardinality constraint for properties that occur exactly once (one)
static Cardinality CC_OPTIONAL
          Cardinality constraint for properties that occur once or not at all (zero to one)
static long UNBOUNDED
          Value for unrestricted maxOccurs
 
Constructor Summary
Cardinality()
          Creates a default cardinality constraint with minOccurs and maxOccurs one.

NOTE: Instead of using the constructor to create new instances please use get(long, long) if possible.
 
Method Summary
static Cardinality get(long minOccurs, long maxOccurs)
          Get the cardinality constraint with the given occurrences
 long getMaxOccurs()
          Get the number of maximum occurrences of a property
 long getMinOccurs()
          Get the number of minimum occurrences of a property
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNBOUNDED

public static final long UNBOUNDED
Value for unrestricted maxOccurs

See Also:
Constant Field Values

CC_EXACTLY_ONCE

public static final Cardinality CC_EXACTLY_ONCE
Cardinality constraint for properties that occur exactly once (one)


CC_OPTIONAL

public static final Cardinality CC_OPTIONAL
Cardinality constraint for properties that occur once or not at all (zero to one)


CC_AT_LEAST_ONCE

public static final Cardinality CC_AT_LEAST_ONCE
Cardinality constraint for properties that occur at least once (one to infinity)


CC_ANY_NUMBER

public static final Cardinality CC_ANY_NUMBER
Cardinality constraint for properties that occur in any number (zero to infinity)

Constructor Detail

Cardinality

public Cardinality()
Creates a default cardinality constraint with minOccurs and maxOccurs one.

NOTE: Instead of using the constructor to create new instances please use get(long, long) if possible.

Method Detail

get

public static Cardinality get(long minOccurs,
                              long maxOccurs)
Get the cardinality constraint with the given occurrences

Parameters:
minOccurs - the number of minimum occurrences of a property, may not be negative
maxOccurs - the number of maximum occurrences of a property, -1L for an infinite maximum occurrence
Returns:
the cardinality constraint

getMinOccurs

public long getMinOccurs()
Get the number of minimum occurrences of a property

Returns:
the number of minimum occurrences of a property

getMaxOccurs

public long getMaxOccurs()
Get the number of maximum occurrences of a property

Returns:
the number of maximum occurrences of a property

Humboldt Alignment Editor 2.5.0

Build 2012-12-03_12-30-59
Revision 9d2dd4b0318cda9f1393b1ddd390f7f792d70a2d