org.apache.jackrabbit.core.nodetype
Class NodeDefImpl

java.lang.Object
  extended byorg.apache.jackrabbit.core.nodetype.ItemDefImpl
      extended byorg.apache.jackrabbit.core.nodetype.NodeDefImpl
All Implemented Interfaces:
ItemDef, NodeDef

public class NodeDefImpl
extends ItemDefImpl
implements NodeDef

This class implements the NodeDef interface and additionally provides setter methods for the various node definition attributes.


Field Summary
 
Fields inherited from class org.apache.jackrabbit.core.nodetype.ItemDefImpl
declaringNodeType
 
Fields inherited from interface org.apache.jackrabbit.core.nodetype.NodeDef
EMPTY_ARRAY
 
Fields inherited from interface org.apache.jackrabbit.core.nodetype.ItemDef
ANY_NAME
 
Constructor Summary
NodeDefImpl()
          Default constructor.
 
Method Summary
 boolean allowsSameNameSiblings()
          Reports whether this node can have same-name siblings.
 boolean definesNode()
          Determines whether this item definition defines a node.
 boolean equals(Object obj)
          Compares two node definitions for equality.
 QName getDefaultPrimaryType()
          Returns the name of the default primary type.
 NodeDefId getId()
          Returns an identifier for this node definition.

The identifier is computed based on the characteristics of this property definition, i.e.

 QName[] getRequiredPrimaryTypes()
          Returns the array of names of the required primary types.
 int hashCode()
          Returns zero to satisfy the Object equals/hashCode contract.
 void setAllowsSameNameSiblings(boolean allowsSameNameSiblings)
          Sets the 'allowsSameNameSiblings' flag.
 void setAutoCreated(boolean autoCreated)
          Sets the 'autoCreated' flag.
 void setDeclaringNodeType(QName declaringNodeType)
          Sets the name of declaring node type.
 void setDefaultPrimaryType(QName defaultNodeType)
          Sets the name of default primary type.
 void setMandatory(boolean mandatory)
          Sets the 'mandatory' flag.
 void setName(QName name)
          Sets the name of the child item.
 void setOnParentVersion(int onParentVersion)
          Sets the 'onParentVersion' attribute.
 void setProtected(boolean writeProtected)
          Sets the 'protected' flag.
 void setRequiredPrimaryTypes(QName[] requiredPrimaryTypes)
          Sets the names of the required primary types.
 
Methods inherited from class org.apache.jackrabbit.core.nodetype.ItemDefImpl
definesResidual, getDeclaringNodeType, getName, getOnParentVersion, isAutoCreated, isMandatory, isProtected
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.jackrabbit.core.nodetype.ItemDef
definesResidual, getDeclaringNodeType, getName, getOnParentVersion, isAutoCreated, isMandatory, isProtected
 

Constructor Detail

NodeDefImpl

public NodeDefImpl()
Default constructor.

Method Detail

setDefaultPrimaryType

public void setDefaultPrimaryType(QName defaultNodeType)
Sets the name of default primary type.

Parameters:
defaultNodeType -

setRequiredPrimaryTypes

public void setRequiredPrimaryTypes(QName[] requiredPrimaryTypes)
Sets the names of the required primary types.

Parameters:
requiredPrimaryTypes -

setAllowsSameNameSiblings

public void setAllowsSameNameSiblings(boolean allowsSameNameSiblings)
Sets the 'allowsSameNameSiblings' flag.

Parameters:
allowsSameNameSiblings -

setDeclaringNodeType

public void setDeclaringNodeType(QName declaringNodeType)
Sets the name of declaring node type.

Overrides:
setDeclaringNodeType in class ItemDefImpl
Parameters:
declaringNodeType - name of the declaring node type (must not be null)

setName

public void setName(QName name)
Sets the name of the child item.

Overrides:
setName in class ItemDefImpl
Parameters:
name - name of child item (must not be null)

setAutoCreated

public void setAutoCreated(boolean autoCreated)
Sets the 'autoCreated' flag.

Overrides:
setAutoCreated in class ItemDefImpl
Parameters:
autoCreated - a boolean

setOnParentVersion

public void setOnParentVersion(int onParentVersion)
Sets the 'onParentVersion' attribute.

Overrides:
setOnParentVersion in class ItemDefImpl
Parameters:
onParentVersion - any of the following constants:
  • OnParentVersionAction.COPY
  • OnParentVersionAction.VERSION
  • OnParentVersionAction.INITIALIZE
  • OnParentVersionAction.COMPUTE
  • OnParentVersionAction.IGNORE
  • OnParentVersionAction.ABORT

setProtected

public void setProtected(boolean writeProtected)
Sets the 'protected' flag.

Overrides:
setProtected in class ItemDefImpl
Parameters:
writeProtected - a boolean

setMandatory

public void setMandatory(boolean mandatory)
Sets the 'mandatory' flag.

Overrides:
setMandatory in class ItemDefImpl
Parameters:
mandatory - a boolean

getId

public NodeDefId getId()
Returns an identifier for this node definition.

The identifier is computed based on the characteristics of this property definition, i.e. modifying attributes of this property definition will have impact on the identifier returned by this method.

Specified by:
getId in interface NodeDef
Returns:
an identifier for this node definition.

getDefaultPrimaryType

public QName getDefaultPrimaryType()
Returns the name of the default primary type.

Specified by:
getDefaultPrimaryType in interface NodeDef
Returns:
the name of the default primary type.

getRequiredPrimaryTypes

public QName[] getRequiredPrimaryTypes()
Returns the array of names of the required primary types.

Specified by:
getRequiredPrimaryTypes in interface NodeDef
Returns:
the array of names of the required primary types.

allowsSameNameSiblings

public boolean allowsSameNameSiblings()
Reports whether this node can have same-name siblings.

Specified by:
allowsSameNameSiblings in interface NodeDef
Returns:
the 'allowsSameNameSiblings' flag.

definesNode

public boolean definesNode()
Determines whether this item definition defines a node.

Specified by:
definesNode in interface ItemDef
Returns:
always true

equals

public boolean equals(Object obj)
Compares two node definitions for equality. Returns true if the given object is a node defintion and has the same attributes as this node definition.

Overrides:
equals in class ItemDefImpl
Parameters:
obj - the object to compare this node definition with
Returns:
true if the object is equal to this node definition, false otherwise
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Returns zero to satisfy the Object equals/hashCode contract. This class is mutable and not meant to be used as a hash key.

Overrides:
hashCode in class ItemDefImpl
Returns:
always zero
See Also:
Object.hashCode()


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