org.elkoserver.objdb.store
Class PutDesc

java.lang.Object
  extended by org.elkoserver.objdb.store.PutDesc
All Implemented Interfaces:
Encodable
Direct Known Subclasses:
UpdateDesc

public class PutDesc
extends Object
implements Encodable

Description of a request write to the object store.

See Also:
ObjectStore.putObjects()

Constructor Summary
PutDesc(String ref, String obj, OptString collectionName, OptBoolean requireNew)
          JSON-driven constructor.
PutDesc(String ref, String obj, String collectionName, boolean requireNew)
          Direct constructor.
 
Method Summary
 String collectionName()
          Get the collection name.
 JSONLiteral encode(EncodeControl control)
          Encode this object for transmission or persistence.
 boolean isRequireNew()
          Test if this write must be to a new object.
 String obj()
          Get the object's description.
 String ref()
          Get the object's reference string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PutDesc

@JSONMethod(value={"ref","obj","coll","requirenew"})
public PutDesc(String ref,
                               String obj,
                               OptString collectionName,
                               OptBoolean requireNew)
JSON-driven constructor.

Parameters:
ref - Object reference of the object to write.
obj - Object description.
collectionName - Name of collection to write to, or omit to take the configured default.
requireNew - Optional flag to force failure if object with ref already exists.

PutDesc

public PutDesc(String ref,
               String obj,
               String collectionName,
               boolean requireNew)
Direct constructor.

Parameters:
ref - Object reference for the object.
obj - Object description (a JSON string describing the object).
collectionName - Name of collection to write to, or null to take the configured default.
requireNew - If true and an object with the given ref already exists, the write fails.
Method Detail

encode

public JSONLiteral encode(EncodeControl control)
Encode this object for transmission or persistence.

Specified by:
encode in interface Encodable
Parameters:
control - Encode control determining what flavor of encoding should be done.
Returns:
a JSON literal representing this object.

collectionName

public String collectionName()
Get the collection name.

Returns:
the collection name to write to, or null to indicate the default

obj

public String obj()
Get the object's description.

Returns:
the object's description (a JSON string).

ref

public String ref()
Get the object's reference string.

Returns:
the object reference string of the object to write.

isRequireNew

public boolean isRequireNew()
Test if this write must be to a new object.

Returns:
true if this write must be to a new object.