org.gcube.contentmanagement.contentmanager.stubs.model.constraints
Class Constraints

java.lang.Object
  extended by org.gcube.contentmanagement.contentmanager.stubs.model.constraints.Constraints

public class Constraints
extends java.lang.Object

Predefined Constraint implementations.

Author:
Fabio Simeoni (University of Strathclyde)

Field Summary
static Constraint<java.lang.Object> anyval
          The null constraint.
 
Constructor Summary
Constraints()
           
 
Method Summary
static Constraint<java.util.Calendar> after(java.util.Calendar c)
          Returns a After constraint for a given calendar.
static Constraint<java.util.Date> afterDate(java.util.Date d)
          Returns an AfterDate constraint for a given date.
static
<T> Constraint<T>
all(Constraint<T>... cs)
          Returns an All constraint for given constraints.
static Constraint<java.util.Calendar> before(java.util.Calendar c)
          Returns a Before constraint for a given calendar.
static Constraint<java.util.Date> before(java.util.Date d)
          Returns a BeforeDate constraint for a given date.
static
<T> Constraint<T>
either(Constraint<T>... cs)
          Returns an Either constraint for given constraints.
static Constraint<java.util.Calendar> future()
          Returns an After constraint for the current date.
static Constraint<java.util.Date> futureDate()
          Returns an AfterDate constraint for the current date.
static
<T> Same<T>
is(T o)
          Returns a Same constraint for a given value.
static Constraint<java.lang.Double> less(double than)
          Returns a Less constraint for a maximum value.
static Match matches(java.lang.String regex)
          Returns a Match constraint for a given regular expression.
static Constraint<java.lang.Double> more(double than)
          Returns a More constraint for a minimum value.
static
<T> Constraint<T>
not(Constraint<T> c)
          Returns an Not constraint for a given constraint.
static Constraint<java.util.Calendar> past()
          Returns an BEfore constraint for the current date.
static Constraint<java.util.Date> pastDate()
          Returns a BeforeDate constraint for the current date.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

anyval

public static final Constraint<java.lang.Object> anyval
The null constraint.

Constructor Detail

Constraints

public Constraints()
Method Detail

is

public static <T> Same<T> is(T o)
Returns a Same constraint for a given value.

Parameters:
o - the value.
Returns:
the constraint.

matches

public static Match matches(java.lang.String regex)
Returns a Match constraint for a given regular expression.

Parameters:
regexp - the expression.
Returns:
the constraint.

all

public static <T> Constraint<T> all(Constraint<T>... cs)
Returns an All constraint for given constraints.

Type Parameters:
T - the type of constrained values.
Parameters:
cs - the constraints.
Returns:
the constraint.

either

public static <T> Constraint<T> either(Constraint<T>... cs)
Returns an Either constraint for given constraints.

Type Parameters:
T - the type of constrained values.
Parameters:
cs - the constraints.
Returns:
the constraint.

not

public static <T> Constraint<T> not(Constraint<T> c)
Returns an Not constraint for a given constraint.

Type Parameters:
T - the type of constrained values.
Parameters:
c - the given constraint.
Returns:
the constraint.

more

public static Constraint<java.lang.Double> more(double than)
Returns a More constraint for a minimum value.

Parameters:
the - minimum value.
Returns:
the constraint.

less

public static Constraint<java.lang.Double> less(double than)
Returns a Less constraint for a maximum value.

Parameters:
than - the maximum value.
Returns:
the constraint

before

public static Constraint<java.util.Date> before(java.util.Date d)
Returns a BeforeDate constraint for a given date.

Parameters:
d - the date.
Returns:
the constraint.

afterDate

public static Constraint<java.util.Date> afterDate(java.util.Date d)
Returns an AfterDate constraint for a given date.

Parameters:
d - the date.
Returns:
the constraint.

futureDate

public static Constraint<java.util.Date> futureDate()
Returns an AfterDate constraint for the current date.

Returns:
the constraint.

pastDate

public static Constraint<java.util.Date> pastDate()
Returns a BeforeDate constraint for the current date.

Returns:
the constraint.

before

public static Constraint<java.util.Calendar> before(java.util.Calendar c)
Returns a Before constraint for a given calendar.

Parameters:
c - the calendar.
Returns:
the constraint.

after

public static Constraint<java.util.Calendar> after(java.util.Calendar c)
Returns a After constraint for a given calendar.

Parameters:
c - the calendar.
Returns:
the constraint.

future

public static Constraint<java.util.Calendar> future()
Returns an After constraint for the current date.

Returns:
the constraint.

past

public static Constraint<java.util.Calendar> past()
Returns an BEfore constraint for the current date.

Returns:
the constraint.