org.modeshape.jcr.cache

## Interface ChildReferences

- All Superinterfaces:
    Iterable<ChildReference>
  All Known Implementing Classes:
    AbstractChildReferences, ImmutableChildReferences.EmptyChildReferences, ImmutableChildReferences.Medium, ImmutableChildReferences.ReferencesUnion, ImmutableChildReferences.Segmented, MutableChildReferences, SessionChildReferences

      @Immutable
      public interface ChildReferences
      extends Iterable<ChildReference>

  An interface used to access the `ChildReference` instances owned by a parent node.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `ChildReferences.BasicContext` A `ChildReferences.Context` implementation that has no changes but maintains the SNS indexes for nodes with any name.
    `static interface` | `ChildReferences.Changes` The representation of a set of changes for the child references.
    `static interface` | `ChildReferences.ChildInsertions` A representation of the child references that were inserted before some other node.
    `static interface` | `ChildReferences.Context` The context in which the names are evaluated.
    `static class` | `ChildReferences.NoChanges`
    `static class` | `ChildReferences.NoContext` A `ChildReferences.Changes` implementation that has no changes and that is useful when there are never any siblings with the same names, since it always returns '1' for the SNS index.
    `static class` | `ChildReferences.NoSnsIndexesContext` A `ChildReferences.Context` implementation that has no changes and that always returns '1' for the SNS index.
    `static class` | `ChildReferences.SingleNameContext` A `ChildReferences.Context` implementation that has no changes and can be used to find the SNS indexes for nodes named a single name.
    `static class` | `ChildReferences.WithChanges` A `ChildReferences.Context` implementation that has changes and can be used to find the SNS indexes for nodes named a single name.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static long` | `UNKNOWN_SIZE` A constant that might be returned by `size()` if the number of child references is unknown.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Iterator<NodeKey>` | `getAllKeys()` Get the keys for all of the children.
    `ChildReference` | `getChild(Name name)` Look for the child reference that has the given name and a SNS index of '1'.
    `ChildReference` | `getChild(Name name, int snsIndex)` Look for the child reference that has the given name and SNS index.
    `ChildReference` | `getChild(Name name, int snsIndex, ChildReferences.Context context)` Look for the child reference that has the given name and SNS index.
    `ChildReference` | `getChild(NodeKey key)` Look for the child reference that has the node key.
    `ChildReference` | `getChild(NodeKey key, ChildReferences.Context context)` Look for the child reference that has the node key.
    `ChildReference` | `getChild(Path.Segment segment)` Look for the child reference that has the given name and SNS index.
    `int` | `getChildCount(Name name)` Return the number of nodes that have the supplied name.
    `boolean` | `hasChild(NodeKey key)` Determine if this contains a reference to the specified child.
    `boolean` | `isEmpty()` Determine if there are no references in this container.
    `Iterator<ChildReference>` | `iterator()` Get an iterator over all of the children.
    `Iterator<ChildReference>` | `iterator(ChildReferences.Context context)` Get an iterator over all child references in this collection, using the supplied context.
    `Iterator<ChildReference>` | `iterator(ChildReferences.Context context, Collection<?> namePatterns, NamespaceRegistry registry)` Get an iterator over all of the children that have `names` (excluding same-name-sibling indexes) matching at least one of the supplied patterns, using the supplied context.
    `Iterator<ChildReference>` | `iterator(Collection<?> namePatterns, NamespaceRegistry registry)` Get an iterator over all of the children that have `names` (excluding same-name-sibling indexes) matching at least one of the supplied patterns.
    `Iterator<ChildReference>` | `iterator(Name name)` Get an iterator over all of the children that have same name matching the supplied value.
    `Iterator<ChildReference>` | `iterator(Name name, ChildReferences.Context context)` Get an iterator over all of the children that have same name matching the supplied value.
    `long` | `size()` Get the total number of child references for the node, including all subsequent blocks of ChildReferences.
    `boolean` | `supportsGetChildReferenceByKey()` Return whether it is possible/feasible to `find` a ChildReference for a child node given only its NodeKey.

- - ### Field Detail

    - #### UNKNOWN_SIZE

          static final long UNKNOWN_SIZE

      A constant that might be returned by `size()` if the number of child references is unknown.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### size

          long size()

      Get the total number of child references for the node, including all subsequent blocks of ChildReferences.
      Returns:
        the total number of children, or `UNKNOWN_SIZE`

    - #### isEmpty

          boolean isEmpty()

      Determine if there are no references in this container. This is equivalent to calling `size() == 0` but may be faster.
      Returns:
        true if there are no references in this container, or false if there are.

    - #### getChildCount

          int getChildCount(Name name)

      Return the number of nodes that have the supplied name. If there are no siblings with the same supplied name, this method will return 1; otherwise it will return the number of same-name-siblings.
      Parameters:
        `name` - the name
      Returns:
        the number of siblings with the supplied name; never negative

    - #### getChild

          ChildReference getChild(Name name)

      Look for the child reference that has the given name and a SNS index of '1'.
      Parameters:
        `name` - the name for the node
      Returns:
        the child reference, or null if there is no such child

    - #### getChild

          ChildReference getChild(Name name,
                                int snsIndex)

      Look for the child reference that has the given name and SNS index.
      Parameters:
        `name` - the name for the node
        `snsIndex` - the same-name-sibling index; must be positive
      Returns:
        the child reference, or null if there is no such child

    - #### getChild

          ChildReference getChild(Name name,
                                int snsIndex,
                                ChildReferences.Context context)

      Look for the child reference that has the given name and SNS index.
      Parameters:
        `name` - the name for the node
        `snsIndex` - the same-name-sibling index; must be positive
        `context` - the context in which the child should be evaluated; may be null if there is no context
      Returns:
        the child reference, or null if there is no such child

    - #### getChild

          ChildReference getChild(Path.Segment segment)

      Look for the child reference that has the given name and SNS index.
      Parameters:
        `segment` - the path segment, which defines the name and SNS index
      Returns:
        the child reference, or null if there is no such child

    - #### hasChild

          boolean hasChild(NodeKey key)

      Determine if this contains a reference to the specified child.
      Parameters:
        `key` - the node key of the child
      Returns:
        true if there is a child reference, or false if there is none

    - #### getChild

          ChildReference getChild(NodeKey key)

      Look for the child reference that has the node key.
      Parameters:
        `key` - the node key of the child
      Returns:
        the child reference, or null if there is no such child

    - #### getChild

          ChildReference getChild(NodeKey key,
                                ChildReferences.Context context)

      Look for the child reference that has the node key.
      Parameters:
        `key` - the node key of the child
        `context` - the context in which the child should be evaluated; may be null if there is no context
      Returns:
        the child reference, or null if there is no such child

    - #### supportsGetChildReferenceByKey

          boolean supportsGetChildReferenceByKey()

      Return whether it is possible/feasible to `find` a ChildReference for a child node given only its NodeKey. Implementations that have very large numbers of children may provide an alternative way to `lookup` a child reference directly. In such cases, this method may return false.
      Returns:
        true if `getChild(NodeKey)` and `getChild(NodeKey, Context)` should be used to find the ChildReference, or false if doing so is not recommended.

    - #### iterator

          Iterator<ChildReference> iterator(Name name)

      Get an iterator over all of the children that have same name matching the supplied value. This essentially returns an iterator over all of the same-name-siblings.
      Parameters:
        `name` - the name of the same-name-sibling nodes; may not be null
      Returns:
        the iterator; never null

    - #### iterator

          Iterator<ChildReference> iterator(Name name,
                                          ChildReferences.Context context)

      Get an iterator over all of the children that have same name matching the supplied value. This essentially returns an iterator over all of the same-name-siblings.
      Parameters:
        `name` - the name of the same-name-sibling nodes; may not be null
        `context` - the context in which the child should be evaluated; may be null if there is no context
      Returns:
        the iterator; never null

    - #### iterator

          Iterator<ChildReference> iterator()

      Get an iterator over all of the children.
      Specified by:
        `iterator` in interface `Iterable<ChildReference>`
      Returns:
        the iterator; never null

    - #### iterator

          Iterator<ChildReference> iterator(Collection<?> namePatterns,
                                          NamespaceRegistry registry)

      Get an iterator over all of the children that have `names` (excluding same-name-sibling indexes) matching at least one of the supplied patterns.
      Parameters:
        `namePatterns` - the list of string literals or regex patterns describing the names
        `registry` - the namespace registry, used to convert names to a form compatible with the name patterns
      Returns:
        the iterator; never null

    - #### iterator

          Iterator<ChildReference> iterator(ChildReferences.Context context)

      Get an iterator over all child references in this collection, using the supplied context.
      Parameters:
        `context` - the context in which the child should be evaluated; may be null if there is no context
      Returns:
        the iterator over all references; never null

    - #### iterator

          Iterator<ChildReference> iterator(ChildReferences.Context context,
                                          Collection<?> namePatterns,
                                          NamespaceRegistry registry)

      Get an iterator over all of the children that have `names` (excluding same-name-sibling indexes) matching at least one of the supplied patterns, using the supplied context. The resulting iterator is lazy where possible, but it may be an expensive call if there are large numbers of children.
      Parameters:
        `context` - the context in which the child should be evaluated; may be null if there is no context
        `namePatterns` - the list of string literals or regex patterns describing the names
        `registry` - the namespace registry, used to convert names to a form compatible with the name patterns
      Returns:
        the iterator; never null

    - #### getAllKeys

          Iterator<NodeKey> getAllKeys()

      Get the keys for all of the children. The resulting iterator is lazy where possible, but it may be an expensive call if there are large numbers of children.
      Returns:
        the iterator over the keys; never null

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