Class ConstraintUtils
- java.lang.Object
-
- org.nuxeo.ecm.core.schema.types.constraints.ConstraintUtils
-
public final class ConstraintUtils extends Object
Some usefull utils for Constraint API.- Since:
- 7.1
-
-
Field Summary
Fields Modifier and Type Field Description static String
DATE_FORMAT
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SimpleDateFormat
formatter()
static <T extends Constraint>
TgetConstraint(Collection<Constraint> constraints, Class<T> constraintClass)
static BigDecimal
objectToBigDecimal(Object object)
Supports any object which toString method return a numeric as String.static Long
objectToPostiveLong(Object object)
Supports any object which toString method return a positive numeric as String.static Long
objectToTimeMillis(Object object)
-
-
-
Field Detail
-
DATE_FORMAT
public static final String DATE_FORMAT
- See Also:
- Constant Field Values
-
-
Method Detail
-
formatter
public static SimpleDateFormat formatter()
- Returns:
- a date formatter xsd compliant : "yyyy-MM-dd"
- Since:
- 7.1
-
objectToTimeMillis
public static Long objectToTimeMillis(Object object)
- Parameters:
object
- Any object- Returns:
- a date represented as number of milliseconds since january 1 1970 if the object is supported, null otherwise.
- Since:
- 7.1
-
objectToBigDecimal
public static BigDecimal objectToBigDecimal(Object object)
Supports any object which toString method return a numeric as String.- Parameters:
object
- Any object- Returns:
- a BigDecimal if the object represent a number, null otherwise.
- Since:
- 7.1
-
objectToPostiveLong
public static Long objectToPostiveLong(Object object)
Supports any object which toString method return a positive numeric as String.- Parameters:
object
- Any object- Returns:
- a positive long value (rounded if needed) if the object represent a positive numeric, null otherwise.
- Since:
- 7.1
-
getConstraint
public static <T extends Constraint> T getConstraint(Collection<Constraint> constraints, Class<T> constraintClass)
-
-