@SerializeWith(value=SchematicEntryLiteral.Externalizer.class) public class SchematicEntryLiteral extends Object implements SchematicEntry, org.infinispan.atomic.DeltaAware
SchematicEntry.AtomicHashMap| Modifier and Type | Class and Description |
|---|---|
static class |
SchematicEntryLiteral.Externalizer
The
Externalizer for SchematicEntryLiteral instances. |
protected static class |
SchematicEntryLiteral.FieldPath |
SchematicEntry.FieldName| 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) |
| Modifier and Type | Method and Description |
|---|---|
Document |
asDocument()
|
void |
commit() |
SchematicEntryLiteral |
copyForWrite() |
protected void |
createDelta(org.infinispan.schematic.internal.CacheContext context) |
protected MutableDocument |
data() |
org.infinispan.atomic.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,
org.infinispan.context.FlagContainer flagContainer)
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(org.infinispan.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() |
public SchematicEntryLiteral()
public SchematicEntryLiteral(String key)
protected SchematicEntryLiteral(MutableDocument document)
protected SchematicEntryLiteral(String key, Document content, Document metadata, String defaultContentType)
public static SchematicEntry newInstance(org.infinispan.Cache<String,SchematicEntry> cache, String key)
SchematicEntryLookup.getSchematicValue(CacheContext, String).cache - underlying cachekey - key under which the schematic value existsprotected final String key()
public SchematicEntryLiteral copyForWrite()
protected final MutableDocument data()
protected void setDocument(Document document)
public SchematicEntry getProxy(org.infinispan.schematic.internal.CacheContext context, String mapKey, org.infinispan.context.FlagContainer flagContainer)
context - the cache contextmapKey - the keyflagContainer - the flag containerSchematicEntryProxypublic void markRemoved(boolean b)
public org.infinispan.atomic.Delta delta()
delta in interface org.infinispan.atomic.DeltaAwareprotected final SchematicDelta getDelta()
protected void createDelta(org.infinispan.schematic.internal.CacheContext context)
public void commit()
commit in interface org.infinispan.atomic.DeltaAwarepublic Document getMetadata()
SchematicEntrygetMetadata in interface SchematicEntryprotected String getKey()
public String getContentType()
SchematicEntrygetContentType in interface SchematicEntrypublic Object getContent()
SchematicEntryDocument or Binary.
Note that this method will return a non-null value only if the SchematicEntry.hasDocumentContent() method
returns true.getContent in interface SchematicEntryDocument object, or null if there is no contentpublic Document getContentAsDocument()
SchematicEntrySchematicEntry.hasDocumentContent() returns true, and is therefore equivalent to the following:
return hasDocumentContent() ? (Document)getContent() : null;
getContentAsDocument in interface SchematicEntryDocument content, or null if there is no content or the content is a Binary valuepublic Binary getContentAsBinary()
SchematicEntrySchematicEntry.hasDocumentContent() returns false, and is therefore equivalent to the following:
return hasDocumentContent() ? (Binary)getContent() : null;
getContentAsBinary in interface SchematicEntryBinary content, or null if there is no content or if the content is a Documentpublic boolean hasDocumentContent()
SchematicEntrytrue 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;
hasDocumentContent in interface SchematicEntrytrue if the content is a Document, or false otherwisepublic boolean hasBinaryContent()
SchematicEntrytrue 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;
hasBinaryContent in interface SchematicEntrytrue if the content is a Binary value, or false otherwiseprotected void internalSetContent(Document content, Document metadata, String defaultContentType)
protected void internalSetContent(Binary content, Document metadata, String defaultContentType)
public void setContent(Document content, Document metadata, String defaultContentType)
SchematicEntryapplication/json".setContent in interface SchematicEntrycontent - the Document representing the JSON content; may not be nullmetadata - the Document representing the metadata; may be nulldefaultContentType - 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 nullpublic void setContent(Binary content, Document metadata, String defaultContentType)
SchematicEntryBinary data described by the supplied content type.setContent in interface SchematicEntrycontent - the Binary representation of the content; may not be nullmetadata - the Document representing the metadata; may be nulldefaultContentType - 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 nullpublic EditableDocument editDocumentContent()
SchematicEntryeditable 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.editDocumentContent in interface SchematicEntrySchematicEntry.editMetadata()public EditableDocument editMetadata()
SchematicEntryeditable 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.editMetadata in interface SchematicEntrySchematicEntry.editDocumentContent()public Document asDocument()
SchematicEntrymetadata and content
as nested documents.asDocument in interface SchematicEntryCopyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.