|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.compass.core.converter.json.SimpleJsonValueConverter
public class SimpleJsonValueConverter
A simple JSON value converter that supports marshalling. Uses built in registed converters for types such as int, float and String.
| Constructor Summary | |
|---|---|
SimpleJsonValueConverter()
|
|
| Method Summary | |
|---|---|
protected void |
doSetBoost(Property property,
Object root,
ResourcePropertyMapping resourcePropertyMapping,
MarshallingContext context)
A simple extension point that allows to set the boost value for the created Property. |
protected String |
getNullValue(ResourcePropertyMapping resourcePropertyMapping,
MarshallingContext context)
If the converter handle nulls, the value that will be stored in the search engine for null values (during the marshall process). |
protected boolean |
handleNulls(ResourcePropertyMapping resourcePropertyMapping,
MarshallingContext context)
Should the converter handle nulls? |
boolean |
marshall(Resource resource,
Object root,
Mapping mapping,
MarshallingContext context)
Marshals the given object value into a Property which is added to the provided
Resource. |
protected String |
toString(Object value,
ResourcePropertyMapping resourcePropertyMapping,
MarshallingContext context)
Converst a value to a String. |
Object |
unmarshall(Resource resource,
Mapping mapping,
MarshallingContext context)
Not supported operation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleJsonValueConverter()
| Method Detail |
|---|
public boolean marshall(Resource resource,
Object root,
Mapping mapping,
MarshallingContext context)
throws ConversionException
Property which is added to the provided
Resource.
Handles null values based on the given null value mappings by calling getNullValue(org.compass.core.mapping.ResourcePropertyMapping, org.compass.core.marshall.MarshallingContext).
The value itself is converted from an Object to a String using toString(Object, org.compass.core.mapping.ResourcePropertyMapping, org.compass.core.marshall.MarshallingContext).
marshall in interface Converterresource - The resource to marhsall the object toroot - The Object to marshall to the resourcemapping - The mapping definition of how to marshall the Object to the resorucecontext - The context for the current marhslling process
true if data was saved in the the index that can be read.
ConversionException
protected boolean handleNulls(ResourcePropertyMapping resourcePropertyMapping,
MarshallingContext context)
Should the converter handle nulls? Handling nulls means should the
converter process nulls or not. Usually the converter will not
persist null values, but sometimes it might be needed
(MarshallingContext.handleNulls()).
If a specific null value is configured with the ResourcePropertyMapping
then the converter will always handle nulls and write it.
context - The marshalling context
true if the converter should handle null values
protected String getNullValue(ResourcePropertyMapping resourcePropertyMapping,
MarshallingContext context)
null values (during the marshall process). Uses
ResourcePropertyMapping.getNullValue().
resourcePropertyMapping - The resource proeprty mapping to get the null value fromcontext - The marshalling context
nulls.
protected void doSetBoost(Property property,
Object root,
ResourcePropertyMapping resourcePropertyMapping,
MarshallingContext context)
throws ConversionException
Property.
The default implemenation uses the statically defined boost value in the mapping definition
(ResourcePropertyMapping.getBoost()) to set the boost level
using Property.setBoost(float)
property - The property to set the boost onroot - The object that is marshalled into a propertyresourcePropertyMapping - The Resource Property Mapping definition
ConversionException
protected String toString(Object value,
ResourcePropertyMapping resourcePropertyMapping,
MarshallingContext context)
ConverterLookup.lookupConverter(Class).
The resulting converter is then used and uses ResourcePropertyConverter.toString(Object, org.compass.core.mapping.ResourcePropertyMapping).
public Object unmarshall(Resource resource,
Mapping mapping,
MarshallingContext context)
throws ConversionException
unmarshall in interface Converterresource - The resource to unmarshall into an Objectmapping - The mapping definition of how to unmarshall the Resource into an Objectcontext - The context for the current marshalling process
ConversionException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||