Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.jcr.cache.document
Class LazyCachedNode

    java.lang.Object
      org.modeshape.jcr.cache.document.LazyCachedNode

All Implemented Interfaces:
  CachedNode

    @Immutable
    public class LazyCachedNode

extends Object
implements CachedNode

This is an immutable `CachedNode` implementation that lazily loads its content. Technically each instance modifies its internal state, but all the state is based upon a single Document that is read-in only once and never changed again. And thus externally each instance appears to be immutable and invariant.

Nested Class Summary

Nested classes/interfaces inherited from interface org.modeshape.jcr.cache.CachedNode
`CachedNode.ReferenceType`

Constructor Summary
`LazyCachedNode(NodeKey key)`
`LazyCachedNode(NodeKey key, Document document)`

Method Summary
`protected Document` | `document(WorkspaceCache cache)` Get the `Document` that represents this node.
`boolean` | `equals(Object obj)`
`Set<NodeKey>` | `getAdditionalParentKeys(NodeCache cache)` Get the keys for all of the nodes (other than the `primary parent`) under which this node appears.
`ChildReferences` | `getChildReferences(NodeCache cache)` Get the set of child references for this node.
`NodeKey` | `getKey()` Get the key for the node.
`Set<Name>` | `getMixinTypes(NodeCache cache)` Get the set of mixin types for this node.
`Name` | `getName(NodeCache cache)` Get the name for this node, without any same-name-sibiling (SNS) index.
`NodeKey` | `getParentKey(NodeCache cache)` Get the node key for this node's primary parent.
`Path` | `getPath(NodeCache cache)` Get the path to this node.
`Name` | `getPrimaryType(NodeCache cache)` Get the primary type for this node.
`Iterator<Property>` | `getProperties(Collection<?> namePatterns, NodeCache cache)` Get an iterator over all of the properties of this node that have names matching at least one of the supplied patterns.
`Iterator<Property>` | `getProperties(NodeCache cache)` Get an iterator over all of the node's properties.
`Property` | `getProperty(Name name, NodeCache cache)` Get the property with the given name.
`int` | `getPropertyCount(NodeCache cache)` Determine the number of properties that this node contains.
`Set<NodeKey>` | `getReferrers(NodeCache cache, CachedNode.ReferenceType type)` Get the keys of the nodes that have JCR REFERENCE and/or WEAK_REFERENCE properties pointing to this node.
`Path.Segment` | `getSegment(NodeCache cache)` Get the path segment for this node.
`protected Path.Segment` | `getSegment(WorkspaceCache cache)`
`String` | `getString(NamespaceRegistry registry)`
`int` | `hashCode()`
`boolean` | `hasProperties(NodeCache cache)` Determine if the node contains one or more properties.
`boolean` | `hasProperty(Name name, NodeCache cache)` Determine if the node contains a property with the specified name.
`protected CachedNode` | `parent(WorkspaceCache cache)`
`protected ChildReference` | `parentReferenceToSelf(WorkspaceCache cache)` Get the parent node's child reference to this node.
`protected Map<Name,Property>` | `properties()`
`String` | `toString()`
`protected WorkspaceCache` | `workspaceCache(NodeCache cache)`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### LazyCachedNode

    public LazyCachedNode(NodeKey key)

### LazyCachedNode

    public LazyCachedNode(NodeKey key,
                          Document document)

Method Detail

### workspaceCache

    protected final WorkspaceCache workspaceCache(NodeCache cache)

### document

    protected Document document(WorkspaceCache cache)

  Get the `Document` that represents this node.

  Parameters:
    `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
  Returns:
    the document; never null
  Throws:
    `NodeNotFoundException` - if this node no longer exists

### getParentKey

    public NodeKey getParentKey(NodeCache cache)

  Description copied from interface: `CachedNode`
  Get the node key for this node's primary parent.

  Specified by:
    `getParentKey` in interface `CachedNode`
  Parameters:
    `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
  Returns:
    the parent's key; null if this is the root node or it has been removed from the document by someone else

### getAdditionalParentKeys

    public Set<NodeKey> getAdditionalParentKeys(NodeCache cache)

  Description copied from interface: `CachedNode`
  Get the keys for all of the nodes (other than the `primary parent`) under which this node appears.

  Specified by:
    `getAdditionalParentKeys` in interface `CachedNode`
  Parameters:
    `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
  Returns:
    the immutable set of keys to the additional parents, excluding the primary parent

### parent

    protected CachedNode parent(WorkspaceCache cache)

### parentReferenceToSelf

    protected ChildReference parentReferenceToSelf(WorkspaceCache cache)

  Get the parent node's child reference to this node.

  Parameters:
    `cache` - the cache
  Returns:
    the child reference; never null (even for the root node)

### properties

    protected Map<Name,Property> properties()

### getKey

    public NodeKey getKey()

  Description copied from interface: `CachedNode`
  Get the key for the node.

  Specified by:
    `getKey` in interface `CachedNode`
  Returns:
    the node's key; never null

### getName

    public Name getName(NodeCache cache)

  Description copied from interface: `CachedNode`
  Get the name for this node, without any same-name-sibiling (SNS) index.

  Specified by:
    `getName` in interface `CachedNode`
  Parameters:
    `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
  Returns:
    the name; never null, but the root node will have a zero-length name
  See Also:
    `CachedNode.getSegment(NodeCache)`, `CachedNode.getPath(NodeCache)`

### getSegment

    public Path.Segment getSegment(NodeCache cache)

  Description copied from interface: `CachedNode`
  Get the path segment for this node. The segment consists of a name and a same-name-sibling (SNS) index.

  Specified by:
    `getSegment` in interface `CachedNode`
  Parameters:
    `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
  Returns:
    the segment; never null, but the root node will have a zero-length name
  See Also:
    `CachedNode.getName(NodeCache)`, `CachedNode.getPath(NodeCache)`

### getSegment

    protected Path.Segment getSegment(WorkspaceCache cache)

### getPath

    public Path getPath(NodeCache cache)

  Description copied from interface: `CachedNode`
  Get the path to this node.

  Specified by:
    `getPath` in interface `CachedNode`
  Parameters:
    `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
  Returns:
    the node's path; never null with at least one segment for all nodes except the root node
  See Also:
    `CachedNode.getName(NodeCache)`, `CachedNode.getSegment(NodeCache)`

### getPrimaryType

    public Name getPrimaryType(NodeCache cache)

  Description copied from interface: `CachedNode`
  Get the primary type for this node.

  Specified by:
    `getPrimaryType` in interface `CachedNode`
  Parameters:
    `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
  Returns:
    the primary type name; never null

### getMixinTypes

    public Set<Name> getMixinTypes(NodeCache cache)

  Description copied from interface: `CachedNode`
  Get the set of mixin types for this node.

  Specified by:
    `getMixinTypes` in interface `CachedNode`
  Parameters:
    `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
  Returns:
    the immutable list of mixin type names; never null but possibly empty

### getPropertyCount

    public int getPropertyCount(NodeCache cache)

  Description copied from interface: `CachedNode`
  Determine the number of properties that this node contains.

  Specified by:
    `getPropertyCount` in interface `CachedNode`
  Parameters:
    `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
  Returns:
    the number of properties; never negative

### hasProperties

    public boolean hasProperties(NodeCache cache)

  Description copied from interface: `CachedNode`
  Determine if the node contains one or more properties.

  Specified by:
    `hasProperties` in interface `CachedNode`
  Parameters:
    `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
  Returns:
    true if the node has at least one property, or false otherwise

### hasProperty

    public boolean hasProperty(Name name,
                               NodeCache cache)

  Description copied from interface: `CachedNode`
  Determine if the node contains a property with the specified name.

  Specified by:
    `hasProperty` in interface `CachedNode`
  Parameters:
    `name` - the name of the property
    `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
  Returns:
    true if the node has the named property, or false otherwise

### getProperty

    public Property getProperty(Name name,
                                NodeCache cache)

  Description copied from interface: `CachedNode`
  Get the property with the given name.

  Specified by:
    `getProperty` in interface `CachedNode`
  Parameters:
    `name` - the name of the property
    `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
  Returns:
    the property, or null if the property does not exist on this node

### getProperties

    public Iterator<Property> getProperties(NodeCache cache)

  Description copied from interface: `CachedNode`
  Get an iterator over all of the node's properties.

  Specified by:
    `getProperties` in interface `CachedNode`
  Parameters:
    `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
  Returns:
    the property iterator; never null but possibly empty

### getProperties

    public Iterator<Property> getProperties(Collection<?> namePatterns,
                                            NodeCache cache)

  Description copied from interface: `CachedNode`
  Get an iterator over all of the properties of this node that have names matching at least one of the supplied patterns.

  Specified by:
    `getProperties` in interface `CachedNode`
  Parameters:
    `namePatterns` - the regex patterns or string literals describing the names
    `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
  Returns:
    the property iterator; never null but possibly empty

### getChildReferences

    public ChildReferences getChildReferences(NodeCache cache)

  Description copied from interface: `CachedNode`
  Get the set of child references for this node. Note that each child reference will need to be resolved by the caller.

  Specified by:
    `getChildReferences` in interface `CachedNode`
  Parameters:
    `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
  Returns:
    the representation of the children of this node; never null but possibly empty

### getReferrers

    public Set<NodeKey> getReferrers(NodeCache cache,
                                     CachedNode.ReferenceType type)

  Description copied from interface: `CachedNode`
  Get the keys of the nodes that have JCR REFERENCE and/or WEAK_REFERENCE properties pointing to this node.

  Specified by:
    `getReferrers` in interface `CachedNode`
  Parameters:
    `cache` - the cache to which this node belongs, required in case this node needs to use the cache; may not be null
    `type` - the flag specifying whether nodes with REFERENCE properties and/or WEAK reference properties should be included in the result; may not be null
  Returns:
    the set of keys to the nodes that have a reference to this node; never null but possibly empty

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### getString

    public String getString(NamespaceRegistry registry)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ModeShape Distribution 3.0.0.Alpha6
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.