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 Details

  • Method Details

    • formatter

      public static SimpleDateFormat formatter()
      Returns:
      a date formatter xsd compliant : "yyyy-MM-dd"
      Since:
      7.1
    • objectToTimeMillis

      public static Long objectToTimeMillis(Object object)
      Supports Date, Calendar, Number and String formatted as YYYY-MM-DD
      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)