6.7.16 Value Constraints

Each string in the array returned by PropertyDefinition.getValueConstraints() specifies a constraint on the value(s) of the property. The constraints are OR-ed together, meaning that in order to be valid, the value (each of the values, in the case of multi-value properties) must meet at least one of the constraints. For example, a constraint array of ["constraint1", "constraint2", "constraint3"] has the interpretation: "the value of this property must meet either constraint1, constraint2 or constraint3".

Reporting constraint information is optional. Therefore, the return of an empty array indicates that there are no discoverable constraints, meaning that either there are constraints but they are inexpressible in the constraint-string syntax, or constraint discovery is simply not supported.

In the case of multi-value properties, the constraint array returned applies independently to each of the values of the property. For example, if one value meets one constraint in the constraint array while the other meets another, the constraint set is considered met for the property as a whole.

If a property does not exist or (in the case of multi-value properties) contains an empty array, the constraint set is considered to have been met by default since, by definition, no values have failed to meet the constraints.

The constraint strings themselves have different formats and interpretations depending on the type of the property in question. The following describes the value constraint syntax for each property type:

  1. /myapp:products/myapp:televisions

  2. /myapp:products/myapp:televisions/

  3. /myapp:products/*

  4. myapp:products/myapp:televisions

  5. ../myapp:televisions

  6. ../myapp:televisions/*

The following principles apply:

The remaining types all have value constraints in the form of inclusive or exclusive ranges: i.e., "[min, max]", "(min, max)", "(min, max]" or "[min, max)". Where "[" and "]" indicate "inclusive", while "(" and ")" indicate "exclusive". A missing min or max value indicates no bound in that direction. For example [,5] means no minimum but a maximum of 5 (inclusive) while [,] means simply that any value will suffice. The meaning of the min and max values themselves differ between types as follows: