eu.etaxonomy.cdm.remote.json.processor.bean
Class AbstractBeanProcessor<T>

java.lang.Object
  extended by eu.etaxonomy.cdm.remote.json.processor.bean.AbstractBeanProcessor<T>
All Implemented Interfaces:
net.sf.json.processors.JsonBeanProcessor
Direct Known Subclasses:
AbstractCdmBeanProcessor, DerivedUnitFacadeBeanProcessor, KeyStatementBeanProcessor, LuceneDocumentBeanProcessor, PointBeanProcessor, TeamOrPersonBaseBeanProcessor

public abstract class AbstractBeanProcessor<T>
extends Object
implements net.sf.json.processors.JsonBeanProcessor

Author:
a.kohlbecker

Field Summary
static Logger logger
           
 
Constructor Summary
AbstractBeanProcessor()
           
 
Method Summary
protected  void addJsonElement(net.sf.json.JSONObject json, net.sf.json.JsonConfig jsonConfig, String fieldName, Object fieldObject)
           
 Set<String> getExcludes()
           
abstract  List<String> getIgnorePropNames()
          Implementations of this abstract class may override this method in order to supply a List of property names to be ignored in processBean(Object, JsonConfig).
protected  Set<String> getMergedExcludes()
          merges and returns {@link #getIgnorePropNames()} with {@link #excludes}
 net.sf.json.JSONObject processBean(Object bean, net.sf.json.JsonConfig jsonConfig)
           
abstract  net.sf.json.JSONObject processBeanSecondStep(T bean, net.sf.json.JSONObject json, net.sf.json.JsonConfig jsonConfig)
          This method is called ate the end of processBean(Object, JsonConfig) just before the JSONObject is returned.
 void setExcludes(Set<String> excludes)
          This method allows supplying a List of property names to be ignored during the serialization to JSON.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static final Logger logger
Constructor Detail

AbstractBeanProcessor

public AbstractBeanProcessor()
Method Detail

getExcludes

public Set<String> getExcludes()

setExcludes

public void setExcludes(Set<String> excludes)
This method allows supplying a List of property names to be ignored during the serialization to JSON. The excludes will be merged with the property names configured by subclasses which override {@link #getIgnorePropNames()}.

Parameters:
excludes -

getIgnorePropNames

public abstract List<String> getIgnorePropNames()
Implementations of this abstract class may override this method in order to supply a List of property names to be ignored in processBean(Object, JsonConfig). This feature generally is used when #processBeanSecondStep(CdmBase, JSONObject, JsonConfig) is implemented. such that this method is responsible of serializing this property.

Returns:
a List of property names.

getMergedExcludes

protected Set<String> getMergedExcludes()
merges and returns {@link #getIgnorePropNames()} with {@link #excludes}

Returns:

addJsonElement

protected void addJsonElement(net.sf.json.JSONObject json,
                              net.sf.json.JsonConfig jsonConfig,
                              String fieldName,
                              Object fieldObject)
Parameters:
json -
jsonConfig -
fieldName -
fieldObject -

processBean

public final net.sf.json.JSONObject processBean(Object bean,
                                                net.sf.json.JsonConfig jsonConfig)
Specified by:
processBean in interface net.sf.json.processors.JsonBeanProcessor

processBeanSecondStep

public abstract net.sf.json.JSONObject processBeanSecondStep(T bean,
                                                             net.sf.json.JSONObject json,
                                                             net.sf.json.JsonConfig jsonConfig)
This method is called ate the end of processBean(Object, JsonConfig) just before the JSONObject is returned. By overriding this method it is possible to to further processing.

See also getIgnorePropNames()!

Parameters:
bean -
json -
jsonConfig -
Returns:


Copyright © 2007-2013 EDIT. All Rights Reserved.