org.apache.jackrabbit.spi.commons.nodetype.compact
Class QNodeTypeDefinitionsBuilder.QPropertyDefinitionBuilder

java.lang.Object
  extended by org.apache.jackrabbit.spi.commons.nodetype.compact.QNodeTypeDefinitionsBuilder.QPropertyDefinitionBuilder
Direct Known Subclasses:
QNodeTypeDefinitionsBuilderImpl.QPropertyDefinitionBuilderImpl
Enclosing class:
QNodeTypeDefinitionsBuilder

public abstract class QNodeTypeDefinitionsBuilder.QPropertyDefinitionBuilder
extends Object

A builder for a QNodeDefinition


Constructor Summary
QNodeTypeDefinitionsBuilder.QPropertyDefinitionBuilder()
           
 
Method Summary
abstract  QPropertyDefinition build()
          Creates a new QPropertyDefinition instance based on the state of this builder.
abstract  QValue createValue(String value, NamePathResolver resolver)
          Create a new QValue for value of the type this instance represents using the given resolver.
abstract  String createValueConstraint(String constraint, NamePathResolver resolver)
          Validate the given constraint and resolve any prefixes.
 boolean getAutoCreated()
           
 Name getDeclaringNodeType()
           
 QValue[] getDefaultValues()
           
 boolean getMandatory()
           
 boolean getMultiple()
           
 Name getName()
           
 int getOnParentVersion()
           
 boolean getProtected()
           
 int getRequiredType()
           
 String[] getValueConstraints()
           
 void setAutoCreated(boolean autocreate)
           
 void setDeclaringNodeType(Name type)
           
 void setDefaultValues(QValue[] values)
           
 void setMandatory(boolean isMandatory)
           
 void setMultiple(boolean isMultiple)
           
 void setName(Name name)
           
 void setOnParentVersion(int onParent)
           
 void setProtected(boolean isProtected)
           
 void setRequiredType(int type)
           
 void setValueConstraints(String[] constraints)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QNodeTypeDefinitionsBuilder.QPropertyDefinitionBuilder

public QNodeTypeDefinitionsBuilder.QPropertyDefinitionBuilder()
Method Detail

setRequiredType

public void setRequiredType(int type)
Parameters:
type - the required type of the property definition being built.

getRequiredType

public int getRequiredType()
Returns:
the required type of the property definition being built.

setValueConstraints

public void setValueConstraints(String[] constraints)
Parameters:
constraints - array of value constraints of the property definition being built.

getValueConstraints

public String[] getValueConstraints()
Returns:
array of value constraints of the property definition being built.

setDefaultValues

public void setDefaultValues(QValue[] values)
Parameters:
values - array of default values of the property definition being built.

getDefaultValues

public QValue[] getDefaultValues()
Returns:
array of default values of the property definition being built or null if no default values are defined.

setMultiple

public void setMultiple(boolean isMultiple)
Parameters:
isMultiple - true if building a 'multiple' property definition.

getMultiple

public boolean getMultiple()
Returns:
true if building a 'multiple' property definition.

createValueConstraint

public abstract String createValueConstraint(String constraint,
                                             NamePathResolver resolver)
                                      throws InvalidConstraintException
Validate the given constraint and resolve any prefixes.

Parameters:
constraint -
resolver -
Returns:
A syntactically valid value constrained which refers to fully qualified names and paths only.
Throws:
InvalidConstraintException - if constraint cannot be converted to a valid value constrained.

createValue

public abstract QValue createValue(String value,
                                   NamePathResolver resolver)
                            throws ValueFormatException,
                                   RepositoryException
Create a new QValue for value of the type this instance represents using the given resolver.

Parameters:
value -
resolver -
Returns:
a new QValue.
Throws:
ValueFormatException - If the given value cannot be converted to the specified type.
RepositoryException - If another error occurs.

build

public abstract QPropertyDefinition build()
                                   throws IllegalStateException
Creates a new QPropertyDefinition instance based on the state of this builder.

Returns:
a new QPropertyDefinition instance.
Throws:
IllegalStateException - if the instance has not the necessary information to build the QPropertyDefinition instance.

setName

public void setName(Name name)
Parameters:
name - the name of the child item definition being build

getName

public Name getName()
Returns:
the name of the child item definition being build.

setDeclaringNodeType

public void setDeclaringNodeType(Name type)
Parameters:
type - the name of the declaring node type.

getDeclaringNodeType

public Name getDeclaringNodeType()
Returns:
the name of the declaring node type.

setAutoCreated

public void setAutoCreated(boolean autocreate)
Parameters:
autocreate - true if building a 'autocreate' child item definition, false otherwise.

getAutoCreated

public boolean getAutoCreated()
Returns:
true if building a 'autocreate' child item definition, false otherwise.

setOnParentVersion

public void setOnParentVersion(int onParent)
Parameters:
onParent - the 'onParentVersion' attribute of the child item definition being built

getOnParentVersion

public int getOnParentVersion()
Returns:
the 'onParentVersion' attribute of the child item definition being built

setProtected

public void setProtected(boolean isProtected)
Parameters:
isProtected - true if building a 'protected' child item definition, false otherwise.

getProtected

public boolean getProtected()
Returns:
true if building a 'protected' child item definition, false otherwise.

setMandatory

public void setMandatory(boolean isMandatory)
Parameters:
isMandatory - true if building a 'mandatory' child item definition, false otherwise.

getMandatory

public boolean getMandatory()
Returns:
true if building a 'mandatory' child item definition, false otherwise.


Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.