org.infinispan.schematic

## Interface DocumentLibrary

- All Known Subinterfaces:
    SchemaLibrary
  All Known Implementing Classes:
    CacheSchemaLibrary, InMemoryDocumentLibrary, InMemorySchemaLibrary

      public interface DocumentLibrary

  A library of JSON documents.
  Since:
    5.1

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Document` | `get(String key)` Get the document with the supplied key.
    `org.infinispan.util.concurrent.NotifyingFuture<Document>` | `getAsync(String key)` Asynchronous version of `get(String)`.
    `String` | `getName()` Get the name of this library.
    `Document` | `put(String key, Document document)` Store the supplied document at the given key.
    `org.infinispan.util.concurrent.NotifyingFuture<Document>` | `putAsync(String key, Document document)` Asynchronous version of `put(String, Document)`.
    `Document` | `putIfAbsent(String key, Document document)` Store the supplied document at the given key.
    `org.infinispan.util.concurrent.NotifyingFuture<Document>` | `putIfAbsentAsync(String key, Document document)` Asynchronous version of `putIfAbsent(String, Document)`.
    `Document` | `remove(String key)` Remove the existing document at the given key.
    `org.infinispan.util.concurrent.NotifyingFuture<Document>` | `removeAsync(String key)` Asynchronous version of `remove(String)`.
    `Document` | `replace(String key, Document document)` Replace the existing document at the given key with the document that is supplied.
    `org.infinispan.util.concurrent.NotifyingFuture<Document>` | `replaceAsync(String key, Document document)` Asynchronous version of `replace(String, Document)`.

- - ### Method Detail

    - #### getName

          String getName()

      Get the name of this library.
      Returns:
        the library name; never null

    - #### get

          Document get(String key)

      Get the document with the supplied key.
      Parameters:
        `key` - the key or identifier for the document
      Returns:
        the document, or null if there was no document with the supplied key

    - #### put

          Document put(String key,
                     Document document)

      Store the supplied document at the given key.
      Parameters:
        `key` - the key or identifier for the document
        `document` - the document that is to be stored
      Returns:
        the document that was previously stored at this key, or null if there was no document with the supplied key

    - #### putIfAbsent

          Document putIfAbsent(String key,
                             Document document)

      Store the supplied document at the given key.
      Parameters:
        `key` - the key or identifier for the document
        `document` - the document that is to be stored
      Returns:
        the document that was previously stored at this key, or null if there was no document with the supplied key

    - #### replace

          Document replace(String key,
                         Document document)

      Replace the existing document at the given key with the document that is supplied. This method does nothing if there is no document at the given key.
      Parameters:
        `key` - the key or identifier for the document
        `document` - the document that is to replace the existing document
      Returns:
        the document that was replaced, or null if nothing was replaced

    - #### remove

          Document remove(String key)

      Remove the existing document at the given key.
      Parameters:
        `key` - the key or identifier for the document
      Returns:
        the document that was removed, or null if there was no document with the supplied key

    - #### getAsync

          org.infinispan.util.concurrent.NotifyingFuture<Document> getAsync(String key)

      Asynchronous version of `get(String)`. This method does not block on remote calls, even if the library cache mode is synchronous.
      Parameters:
        `key` - the key or identifier for the document
      Returns:
        a future containing the document at the given key; never null

    - #### putAsync

          org.infinispan.util.concurrent.NotifyingFuture<Document> putAsync(String key,
                                                                          Document document)

      Asynchronous version of `put(String, Document)`. This method does not block on remote calls, even if the library cache mode is synchronous.
      Parameters:
        `key` - the key or identifier for the document
        `document` - the document that is to be stored
      Returns:
        a future containing the old document that was previously stored at this key; never null

    - #### putIfAbsentAsync

          org.infinispan.util.concurrent.NotifyingFuture<Document> putIfAbsentAsync(String key,
                                                                                  Document document)

      Asynchronous version of `putIfAbsent(String, Document)`. This method does not block on remote calls, even if the library cache mode is synchronous.
      Parameters:
        `key` - the key or identifier for the document
        `document` - the document that is to be stored
      Returns:
        a future containing the existing document or the new document if there was no existing document at the supplied key

    - #### replaceAsync

          org.infinispan.util.concurrent.NotifyingFuture<Document> replaceAsync(String key,
                                                                              Document document)

      Asynchronous version of `replace(String, Document)`. This method does not block on remote calls, even if the library cache mode is synchronous.
      Parameters:
        `key` - the key or identifier for the document
        `document` - the document that is to be stored
      Returns:
        a future containing the document that was replaced; never null

    - #### removeAsync

          org.infinispan.util.concurrent.NotifyingFuture<Document> removeAsync(String key)

      Asynchronous version of `remove(String)`. This method does not block on remote calls, even if the library cache mode is synchronous.
      Parameters:
        `key` - the key or identifier for the document
      Returns:
        a future containing the old document that was removed; never null

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