org.spicefactory.pimento.intercept
Class EntityEncoder

java.lang.Object
  extended by org.spicefactory.pimento.intercept.EntityEncoder

public class EntityEncoder
extends Object

Exposes a small subset of the entity encoder functionality for interceptor methods. This class may be used as an optional second parameter for interceptor methods that are annoted with @Load and may be used to restrict the property values of an entity that are sent to the client. A single instance of this class always represent only the encoder for a single entity.

Author:
Jens Halm

Constructor Summary
EntityEncoder(boolean proxy)
          Creates a new instance.
 
Method Summary
 void excludeProperty(String name)
          Instructs this encoder to exclude the property with the specified name from the entity sent to the client without modifying the entity itself.
 boolean isExcludedProperty(String name)
          Checks whether the property with the specified name was marked for exclusion.
 boolean isProxy()
          Whether this encoder will be used for an uninitialized proxy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityEncoder

public EntityEncoder(boolean proxy)
Creates a new instance.

Parameters:
proxy - whether this encoder will be used for an uninitialized proxy.
Method Detail

isProxy

public boolean isProxy()
Whether this encoder will be used for an uninitialized proxy. If this property is true, interceptor methods know that invoking any getters on the entity will trigger the state of the entity to be fetched from the database. In many cases it may be intended that the entity gets sent to the client as a proxy to be initialized on demand.

Returns:
whether this encoder will be used for an uninitialized proxy

excludeProperty

public void excludeProperty(String name)
Instructs this encoder to exclude the property with the specified name from the entity sent to the client without modifying the entity itself.

Parameters:
name - the name of the property to exclude

isExcludedProperty

public boolean isExcludedProperty(String name)
Checks whether the property with the specified name was marked for exclusion.

Parameters:
name - the name of the property
Returns:
true if the property with the specified name was marked for exclusion