org.infinispan.schematic.internal

## Class SchematicEntryLiteral

- java.lang.Object
- - org.infinispan.schematic.internal.SchematicEntryLiteral

- All Implemented Interfaces:
    Cloneable, DeltaAware, SchematicEntry

      @SerializeWith(value=SchematicEntryLiteral.Externalizer.class)
      public class SchematicEntryLiteral
      extends Object
      implements SchematicEntry, DeltaAware

  The primary implementation of `SchematicEntry`.
  Since:
    5.1
  See Also:
    `AtomicHashMap`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `SchematicEntryLiteral.Externalizer` The `Externalizer` for `SchematicEntryLiteral` instances.
    `protected static class` | `SchematicEntryLiteral.FieldPath`

    - ### Nested classes/interfaces inherited from interface org.infinispan.schematic.SchematicEntry

      `SchematicEntry.FieldName`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `SchematicEntryLiteral()`
    `protected` | `SchematicEntryLiteral(MutableDocument document)`
    `` | `SchematicEntryLiteral(String key)`
    `protected` | `SchematicEntryLiteral(String key, Binary content, Document metadata, String defaultContentType)`
    `protected` | `SchematicEntryLiteral(String key, Document content, Document metadata, String defaultContentType)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Document` | `asDocument()` Get the representation of this entry as a document, which will include the `metadata` and `content` as nested documents.
    `void` | `commit()`
    `SchematicEntryLiteral` | `copyForWrite()`
    `protected void` | `createDelta(org.infinispan.schematic.internal.CacheContext context)`
    `protected MutableDocument` | `data()`
    `Delta` | `delta()`
    `EditableDocument` | `editDocumentContent()` Get an `editable document`, when the content is a `document`.
    `EditableDocument` | `editMetadata()` Get an `editable metadata document`.
    `Object` | `getContent()` Return this value's content.
    `Binary` | `getContentAsBinary()` Get this value's content, if it is a Binary object.
    `Document` | `getContentAsDocument()` Get this value's content, if it is a Document object.
    `String` | `getContentType()` Get the media type describing the content.
    `protected SchematicDelta` | `getDelta()`
    `protected String` | `getKey()`
    `Document` | `getMetadata()` Get the metadata associated with this value.
    `SchematicEntry` | `getProxy(org.infinispan.schematic.internal.CacheContext context, String mapKey)` Builds a thread-safe proxy for this instance so that concurrent reads are isolated from writes.
    `boolean` | `hasBinaryContent()` Return `true` if the `SchematicEntry.getContent()` method would return a Binary (or `SchematicEntry.getContentAsBinary()` would return a non-null value).
    `boolean` | `hasDocumentContent()` Return `true` if the `SchematicEntry.getContent()` method would return a Document (or `SchematicEntry.getContentAsDocument()` would return a non-null value).
    `protected void` | `internalSetContent(Binary content, Document metadata, String defaultContentType)`
    `protected void` | `internalSetContent(Document content, Document metadata, String defaultContentType)`
    `protected String` | `key()`
    `void` | `markRemoved(boolean b)`
    `static SchematicEntry` | `newInstance(Cache<String,SchematicEntry> cache, String key)` Construction only allowed through this factory method.
    `void` | `setContent(Binary content, Document metadata, String defaultContentType)` Set the content for this value to be the supplied `Binary` data described by the supplied content type.
    `void` | `setContent(Document content, Document metadata, String defaultContentType)` Set the content for this value to be the supplied Document and set the content type to be " `application/json`".
    `protected Object` | `setContent(Object content)`
    `protected void` | `setDocument(Document document)`
    `protected void` | `setMetadata(Document metadata, String defaultContentType)`
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### SchematicEntryLiteral

          public SchematicEntryLiteral()

    - #### SchematicEntryLiteral

          public SchematicEntryLiteral(String key)

    - #### SchematicEntryLiteral

          protected SchematicEntryLiteral(MutableDocument document)

    - #### SchematicEntryLiteral

          protected SchematicEntryLiteral(String key,
                               Document content,
                               Document metadata,
                               String defaultContentType)

    - #### SchematicEntryLiteral

          protected SchematicEntryLiteral(String key,
                               Binary content,
                               Document metadata,
                               String defaultContentType)

  - ### Method Detail

    - #### newInstance

          public static SchematicEntry newInstance(Cache<String,SchematicEntry> cache,
                                   String key)

      Construction only allowed through this factory method. This factory is intended for use internally by the CacheDelegate. User code should use `SchematicEntryLookup.getSchematicValue(CacheContext, String)`.
      Parameters:
        `cache` - underlying cache
        `key` - key under which the schematic value exists
      Returns:
        the schematic entry

    - #### key

          protected final String key()

    - #### copyForWrite

          public SchematicEntryLiteral copyForWrite()

    - #### data

          protected final MutableDocument data()

    - #### setDocument

          protected void setDocument(Document document)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getProxy

          public SchematicEntry getProxy(org.infinispan.schematic.internal.CacheContext context,
                                String mapKey)

      Builds a thread-safe proxy for this instance so that concurrent reads are isolated from writes.
      Parameters:
        `context` - the cache context
        `mapKey` - the key
      Returns:
        an instance of `SchematicEntryProxy`

    - #### markRemoved

          public void markRemoved(boolean b)

    - #### delta

          public Delta delta()

      Specified by:
        `delta` in interface `DeltaAware`

    - #### getDelta

          protected final SchematicDelta getDelta()

    - #### createDelta

          protected void createDelta(org.infinispan.schematic.internal.CacheContext context)

    - #### commit

          public void commit()

      Specified by:
        `commit` in interface `DeltaAware`

    - #### getMetadata

          public Document getMetadata()

      Description copied from interface: `SchematicEntry`
      Get the metadata associated with this value.
      Specified by:
        `getMetadata` in interface `SchematicEntry`
      Returns:
        the metadata document; never null

    - #### getKey

          protected String getKey()

    - #### getContentType

          public String getContentType()

      Description copied from interface: `SchematicEntry`
      Get the media type describing the content.
      Specified by:
        `getContentType` in interface `SchematicEntry`
      Returns:
        the media type; never null

    - #### getContent

          public Object getContent()

      Description copied from interface: `SchematicEntry`
      Return this value's content. The result will either be a `Document` or `Binary`. Note that this method will return a non-null value only if the `SchematicEntry.hasDocumentContent()` method returns `true`.
      Specified by:
        `getContent` in interface `SchematicEntry`
      Returns:
        the content, represented as a `Document` object, or null if there is no content

    - #### getContentAsDocument

          public Document getContentAsDocument()

      Description copied from interface: `SchematicEntry`
      Get this value's content, if it is a Document object. This method will always return a non-null Document if `SchematicEntry.hasDocumentContent()` returns `true`, and is therefore equivalent to the following:

           return hasDocumentContent() ? (Document)getContent() : null;

      Specified by:
        `getContentAsDocument` in interface `SchematicEntry`
      Returns:
        the `Document` content, or null if there is no content or the content is a `Binary` value

    - #### getContentAsBinary

          public Binary getContentAsBinary()

      Description copied from interface: `SchematicEntry`
      Get this value's content, if it is a Binary object. This method will always return a non-null Binary if `SchematicEntry.hasDocumentContent()` returns `false`, and is therefore equivalent to the following:

           return hasDocumentContent() ? (Binary)getContent() : null;

      Specified by:
        `getContentAsBinary` in interface `SchematicEntry`
      Returns:
        the `Binary` content, or null if there is no content or if the content is a `Document`

    - #### hasDocumentContent

          public boolean hasDocumentContent()

      Description copied from interface: `SchematicEntry`
      Return `true` if the `SchematicEntry.getContent()` method would return a Document (or `SchematicEntry.getContentAsDocument()` would return a non-null value).

      This is equivalent to the following:

           return getContent() instanceof Document;

      Specified by:
        `hasDocumentContent` in interface `SchematicEntry`
      Returns:
        `true` if the content is a Document, or `false` otherwise

    - #### hasBinaryContent

          public boolean hasBinaryContent()

      Description copied from interface: `SchematicEntry`
      Return `true` if the `SchematicEntry.getContent()` method would return a Binary (or `SchematicEntry.getContentAsBinary()` would return a non-null value).

      This is equivalent to the following:

           return getContent() instanceof Binary;

      Specified by:
        `hasBinaryContent` in interface `SchematicEntry`
      Returns:
        `true` if the content is a Binary value, or `false` otherwise

    - #### setContent

          protected Object setContent(Object content)

    - #### setMetadata

          protected void setMetadata(Document metadata,
                         String defaultContentType)

    - #### internalSetContent

          protected void internalSetContent(Document content,
                                Document metadata,
                                String defaultContentType)

    - #### internalSetContent

          protected void internalSetContent(Binary content,
                                Document metadata,
                                String defaultContentType)

    - #### setContent

          public void setContent(Document content,
                        Document metadata,
                        String defaultContentType)

      Description copied from interface: `SchematicEntry`
      Set the content for this value to be the supplied Document and set the content type to be " `application/json`".
      Specified by:
        `setContent` in interface `SchematicEntry`
      Parameters:
        `content` - the Document representing the JSON content; may not be null
        `metadata` - the Document representing the metadata; may be null
        `defaultContentType` - the value for the MIME type describing the content that should be used if the metadata does not already contain a "contentType" field, and typically `Schematic.ContentTypes.JSON`, `Schematic.ContentTypes.JSON_SCHEMA` , or `Schematic.ContentTypes.BSON`; may not be null

    - #### setContent

          public void setContent(Binary content,
                        Document metadata,
                        String defaultContentType)

      Description copied from interface: `SchematicEntry`
      Set the content for this value to be the supplied `Binary` data described by the supplied content type.
      Specified by:
        `setContent` in interface `SchematicEntry`
      Parameters:
        `content` - the Binary representation of the content; may not be null
        `metadata` - the Document representing the metadata; may be null
        `defaultContentType` - the value for the MIME type describing the content that should be used if the metadata does not already contain a "contentType" field, and typically `Schematic.ContentTypes.JSON`, `Schematic.ContentTypes.JSON_SCHEMA` , or `Schematic.ContentTypes.BSON`; may not be null

    - #### editDocumentContent

          public EditableDocument editDocumentContent()

      Description copied from interface: `SchematicEntry`
      Get an `editable document`, when the content is a `document`. The client is expected to make these edits within the context of a transaction, and the edits will be saved when the transaction is committed.
      Specified by:
        `editDocumentContent` in interface `SchematicEntry`
      Returns:
        the editable representation of the content document
      See Also:
        `SchematicEntry.editMetadata()`

    - #### editMetadata

          public EditableDocument editMetadata()

      Description copied from interface: `SchematicEntry`
      Get an `editable metadata document`. The client is expected to make these edits within the context of a transaction, and the edits will be saved when the transaction is committed.
      Specified by:
        `editMetadata` in interface `SchematicEntry`
      Returns:
        the editable representation of the document
      See Also:
        `SchematicEntry.editDocumentContent()`

    - #### asDocument

          public Document asDocument()

      Description copied from interface: `SchematicEntry`
      Get the representation of this entry as a document, which will include the `metadata` and `content` as nested documents.
      Specified by:
        `asDocument` in interface `SchematicEntry`
      Returns:
        the entry's representation as a document

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