org.elkoserver.json
Class EncodeControl

java.lang.Object
  extended by org.elkoserver.json.EncodeControl

public class EncodeControl
extends Object

Control object for regulating the behavior of an encoding operation. When an object is being serialized to JSON, the choice of the subset of the object's state that actually gets written can vary depending on the intended destination or use for the data. Currently, there are two cases: encoding for the client and encoding for the repository. However, additional cases are possible; for example, a representation being sent to a client might vary depending on whether the user of the client is the "owner" of the object in question or not. This class exists to provide a place to extend the range of options, though the base case only supports the client vs. repository distinction.


Field Summary
static EncodeControl forClient
          A global, encoding control representing the intention to encode for the client.
static EncodeControl forRepository
          A global, encoding control representing the intention to encode for the repository.
 
Method Summary
 boolean toClient()
          Test if this controller says to encode for the client.
 boolean toRepository()
          Test if this controller says to encode for the repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

forClient

public static final EncodeControl forClient
A global, encoding control representing the intention to encode for the client.


forRepository

public static final EncodeControl forRepository
A global, encoding control representing the intention to encode for the repository.

Method Detail

toClient

public boolean toClient()
Test if this controller says to encode for the client.

Returns:
true if this should be a client encoding.

toRepository

public boolean toRepository()
Test if this controller says to encode for the repository.

Returns:
true if this should be a repository encoding.