On the serialization of CDM entities in the cdmlib-remote RESTful services¶
- Table of contents
- On the serialization of CDM entities in the cdmlib-remote RESTful services
The serialization into JSON and XML is in most cases be done by json-lib The according view class which handles serialization to JSON and to XML is @eu.etaxonomy.cdm.remote.view.JsonView@. Whether it serializes to JSON or XML depends on its configuration @JsonView.setType()@. The json and xml views are configured in the following files:
Other services are using different serialization technologies like JAXB/Dozer etc.
The depth of serialization first of all depends on how deeply an cdm entity and the appendant object graph is initialized.
The actual serialization depth can be configured by two means, the
CardinalityPropertyFilter and by class specific
JsonBeanProcessor@s. Both are configured in @/cdmlib-remote/src/main/resources/eu/etaxonomy/cdm/remote/json/jsonConfigurations.xml
The base class for all bean processors is @eu.etaxonomy.cdm.remote.json.processor.bean.AbstractBeanProcessor@.
Implementation will implement
AbstractBeanProcessor.processBeanSecondStep(T bean, JSONObject json, JsonConfig jsonConfig) in order to modify the JSONObject.
It is also possible to specify "excludes" either in the implementation by overriding
getIgnorePropNames() (will be default excludes) or in the configuration by setting the excludes via @setExcludes(Set excludes)@. Both methods manage lists of property names to be ignored during the serialization the excludes will be merged with the ones configured by subclasses which override @getIgnorePropNames()@.