public abstract class ValueConstraint extends Object implements QValueConstraint
ValueConstraint and its subclasses are used to check the
 syntax of a value constraint and to test if a specific value satisfies
 it.| Modifier and Type | Field and Description | 
|---|---|
| static ValueConstraint[] | EMPTY_ARRAY | 
| protected static org.slf4j.Logger | log | 
| Modifier | Constructor and Description | 
|---|---|
| protected  | ValueConstraint(String definition) | 
| Modifier and Type | Method and Description | 
|---|---|
| static void | checkValueConstraints(QPropertyDefinition pd,
                     QValue[] values)Tests if the value constraints defined in the property definition
  pdare satisfied by the the specifiedvalues. | 
| static ValueConstraint | create(int type,
      String definition)Create a new  ValueConstraintfrom the String representation. | 
| static ValueConstraint[] | create(int type,
      String[] definition)Create a new  ValueConstraintarray from the String
 representation. | 
| static ValueConstraint[] | create(int type,
      String[] jcrDefinition,
      NamePathResolver resolver)Create a new  ValueConstraintarray from the specified JCR
 representations. | 
| static ValueConstraint | create(int type,
      String jcrDefinition,
      NamePathResolver resolver) | 
| boolean | equals(Object other) | 
| String | getDefinition(NamePathResolver resolver)For constraints that are not namespace prefix mapping sensitive this
 method returns the same result as  . | 
| String | getString()For constraints that are not namespace prefix mapping sensitive this
 method returns the same defined in
  . | 
| int | hashCode()Returns the hashCode of the definition String | 
| String | toString()Same as  getString() | 
clone, finalize, getClass, notify, notifyAll, wait, wait, waitcheckprotected static org.slf4j.Logger log
public static final ValueConstraint[] EMPTY_ARRAY
protected ValueConstraint(String definition)
public String getDefinition(NamePathResolver resolver)
getString()
 Those that are namespace prefix mapping sensitive (e.g.
 NameConstraint, PathConstraint and
 ReferenceConstraint) use the given nsResolver
 to reflect the current mapping in the returned value.
 In other words: subclasses, that need to make a conversion to JCR value
 must overwrite this and return a value that has the Names
 or Path properly resolved to their JCR representation.
resolver - name-path resolver(), 
NameResolver.getJCRName(org.apache.jackrabbit.spi.Name), 
PathResolver.getJCRPath(org.apache.jackrabbit.spi.Path)public String getString()
QValueConstraintPropertyDefinition.getValueConstraints()
 Those that are namespace prefix mapping sensitive (e.g.
 NameConstraint, PathConstraint and
 ReferenceConstraint) return an internal string.
getString in interface QValueConstraintQValueConstraint.getString()public String toString()
getString()toString in class ObjectObject.toString()public boolean equals(Object other)
equals in class ObjectObject.equals(Object)public int hashCode()
hashCode in class ObjectObject.hashCode()public static ValueConstraint create(int type, String definition) throws InvalidConstraintException
ValueConstraint from the String representation.
 Note, that the definition must be independent of session specific namespace
 mappings in case of the following constraint types:
 type - required typedefinition - The internal definition string.InvalidConstraintException - if the constraint is not valid.for the corresponding
 method that allows to pass the JCR representation of a constraint
 definition.public static ValueConstraint[] create(int type, String[] definition) throws InvalidConstraintException
ValueConstraint array from the String
 representation. Note, that the definition must be in the internal format
 in case of the following types:
 type - the required typedefinition - internal definition stringsInvalidConstraintException - if one of the constraints is invalidpublic static ValueConstraint[] create(int type, String[] jcrDefinition, NamePathResolver resolver) throws InvalidConstraintException
ValueConstraint array from the specified JCR
 representations.type - the required typejcrDefinition - The definition strings as exposed through the JCR API.resolver - name-path resolverInvalidConstraintException - if one of the constraints is invalidpublic static ValueConstraint create(int type, String jcrDefinition, NamePathResolver resolver) throws InvalidConstraintException
type - required typejcrDefinition - A JCR representation of a value constraint definition.resolver - name-path resolverInvalidConstraintException - if the constraint is invalidpublic static void checkValueConstraints(QPropertyDefinition pd, QValue[] values) throws ConstraintViolationException, RepositoryException
pd are satisfied by the the specified values.
 Note that the protected flag is not checked. Also note that no type conversions are attempted if the type of the given values does not match the required type as specified in the given definition.
pd - property definitionvalues - values to checkConstraintViolationException - if the constraints are violatedRepositoryExceptionCopyright © 2004–2020 The Apache Software Foundation. All rights reserved.