|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jackrabbit.spi.commons.nodetype.constraint.ValueConstraint
public abstract class ValueConstraint
ValueConstraint
and its subclasses are used to check the
syntax of a value constraint and to test if a specific value satisfies
it.
Field Summary | |
---|---|
static ValueConstraint[] |
EMPTY_ARRAY
|
protected static org.slf4j.Logger |
log
|
Constructor Summary | |
---|---|
protected |
ValueConstraint(String definition)
|
Method Summary | |
---|---|
static void |
checkValueConstraints(QPropertyDefinition pd,
QValue[] values)
Tests if the value constraints defined in the property definition pd are satisfied by the the specified values . |
static ValueConstraint |
create(int type,
String definition)
Create a new ValueConstraint from the String representation. |
static ValueConstraint[] |
create(int type,
String[] definition)
Create a new ValueConstraint array from the String
representation. |
static ValueConstraint[] |
create(int type,
String[] jcrDefinition,
NamePathResolver resolver)
Create a new ValueConstraint array 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() |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.jackrabbit.spi.QValueConstraint |
---|
check |
Field Detail |
---|
protected static org.slf4j.Logger log
public static final ValueConstraint[] EMPTY_ARRAY
Constructor Detail |
---|
protected ValueConstraint(String definition)
Method Detail |
---|
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 Name
s
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()
QValueConstraint
PropertyDefinition.getValueConstraints()
.
Those that are namespace prefix mapping sensitive (e.g.
NameConstraint
, PathConstraint
and
ReferenceConstraint
) return an internal string.
getString
in interface QValueConstraint
QValueConstraint.getString()
public String toString()
getString()
toString
in class Object
Object.toString()
public boolean equals(Object other)
equals
in class Object
Object.equals(Object)
public int hashCode()
hashCode
in class Object
Object.hashCode()
public static ValueConstraint create(int type, String definition) throws InvalidConstraintException
ValueConstraint
from the String representation.
Note, that the definition must be independant 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 strings
InvalidConstraintException
- 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 resolver
InvalidConstraintException
- 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 resolver
InvalidConstraintException
- 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
- propert definitionvalues
- values to check
ConstraintViolationException
- if the constraints are violated
RepositoryException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |