org.elkoserver.objdb.store
Class ObjectDesc

java.lang.Object
  extended by org.elkoserver.objdb.store.ObjectDesc
All Implemented Interfaces:
Encodable

public class ObjectDesc
extends Object
implements Encodable

Description of a requested object returned from the object store.

See Also:
ObjectStore.getObjects(), GetResultHandler

Constructor Summary
ObjectDesc(String ref, OptString obj, OptString failure)
          JSON-driven constructor.
ObjectDesc(String ref, String obj, String failure)
          Direct constructor.
 
Method Summary
 JSONLiteral encode(EncodeControl control)
          Encode this object for transmission or persistence.
 String failure()
          Get the error message string.
 String obj()
          Get the requested object's description.
 String ref()
          Get the requested object's reference string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectDesc

@JSONMethod(value={"ref","obj","failure"})
public ObjectDesc(String ref,
                                  OptString obj,
                                  OptString failure)
JSON-driven constructor.

Parameters:
ref - Object reference of the object requested.
obj - Optional object description.
failure - Optional error message.

ObjectDesc

public ObjectDesc(String ref,
                  String obj,
                  String failure)
Direct constructor.

Parameters:
ref - Object reference of the object requested.
obj - Object description (a JSON string describing the object, if the object was retrieved, or null if retrieval failed).
failure - Error message string if retrieval failed, or null if retrieval succeeded.
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.

failure

public String failure()
Get the error message string.

Returns:
the error message string, or null if there is none (i.e., if this represents a success result).

obj

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

Returns:
the requested object's description (a JSON string), or null if there is no object (i.e., if this represents an error result).

ref

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

Returns:
the object reference string of the requested object.