org.modeshape.jcr.spi.federation

## Class PageKey

- java.lang.Object
- - org.modeshape.jcr.spi.federation.PageKey

-     public final class PageKey
      extends Object

  The key used to uniquely identify a page of children. A page key is formed by joining together the id of the owning document, the offset of the page and the size of the block.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PageKey(String key)` Creates a new instance from a raw string, which is expected to contain 3 parts, each representing a piece of information
    `PageKey(String parentId, String offset, long blockSize)` Creates a new page key instance passing in each individual page component

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `getBlockSize()` Returns the size of the block
    `Integer` | `getOffsetInt()` Returns the integer representation of the offset, if the offset is convertible to an integer.
    `String` | `getOffsetString()` Returns the offset of the block, which semantically represents a pointer to the start of the block.
    `String` | `getParentId()` Returns the id of the document which owns the block and effectively the list of children,
    `static boolean` | `isValidFormat(String string)` Checks if the given string is a valid `PageKey` format.
    `String` | `toString()`
    `PageKey` | `withParentId(String parentId)` Creates a new `PageKey` instance which has the given parent ID and the same offset & block size as this page.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### PageKey

          public PageKey(String key)

      Creates a new instance from a raw string, which is expected to contain 3 parts, each representing a piece of information
      Parameters:
        `key` - a `non-null` string
      Throws:
        `IllegalArgumentException` - if the string is not correctly formed.

    - #### PageKey

          public PageKey(String parentId,
                 String offset,
                 long blockSize)

      Creates a new page key instance passing in each individual page component
      Parameters:
        `parentId` - the id of the parent node; may not be `null`
        `offset` - the offset of the page withing the total list of children; may not be `null`
        `blockSize` - the number of children in a page.

  - ### Method Detail

    - #### withParentId

          public PageKey withParentId(String parentId)

      Creates a new `PageKey` instance which has the given parent ID and the same offset & block size as this page.
      Parameters:
        `parentId` - a `String` representing the ID of the new parent; may not be null.
      Returns:
        a new `PageKey` instance; never null.

    - #### getBlockSize

          public long getBlockSize()

      Returns the size of the block
      Returns:
        a long value

    - #### getOffsetString

          public String getOffsetString()

      Returns the offset of the block, which semantically represents a pointer to the start of the block.
      Returns:
        a `non-null` String

    - #### getOffsetInt

          public Integer getOffsetInt()

      Returns the integer representation of the offset, if the offset is convertible to an integer. Otherwise, `null` is returned.
      Returns:
        the int representation of the offset, or null.

    - #### getParentId

          public String getParentId()

      Returns the id of the document which owns the block and effectively the list of children,
      Returns:
        a `non-null` String

    - #### isValidFormat

          public static boolean isValidFormat(String string)

      Checks if the given string is a valid `PageKey` format.
      Parameters:
        `string` - a `String` instance; may be null
      Returns:
        `true` if the string is a valid `PageKey`, `false` otherwise.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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