org.compass.core.converter.json
Class ContextResourcePropertyJsonValueConverter

java.lang.Object
  extended by org.compass.core.converter.json.SimpleJsonValueConverter
      extended by org.compass.core.converter.json.ResourcePropertyJsonValueConverter
          extended by org.compass.core.converter.json.ContextResourcePropertyJsonValueConverter
All Implemented Interfaces:
Converter, ContextResourcePropertyConverter, ResourcePropertyConverter

public class ContextResourcePropertyJsonValueConverter
extends ResourcePropertyJsonValueConverter

Same as ResourcePropertyJsonValueConverter except that can actually handle context conversion since it accepts a ContextResourcePropertyConverter.

Author:
kimchy

Constructor Summary
ContextResourcePropertyJsonValueConverter(ContextResourcePropertyConverter converter)
           
 
Method Summary
 Object fromString(String str, ResourcePropertyMapping resourcePropertyMapping, MarshallingContext context)
          Converts from a String and into it's Object representation.
 String toString(Object value, ResourcePropertyMapping resourcePropertyMapping, MarshallingContext context)
          Converst a value to a String.
 
Methods inherited from class org.compass.core.converter.json.ResourcePropertyJsonValueConverter
canNormalize, fromString, suggestIndex, suggestOmitNorms, suggestOmitTf, suggestStore, suggestTermVector, toString
 
Methods inherited from class org.compass.core.converter.json.SimpleJsonValueConverter
doSetBoost, getNullValue, handleNulls, marshall, unmarshall
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.compass.core.converter.Converter
marshall, unmarshall
 

Constructor Detail

ContextResourcePropertyJsonValueConverter

public ContextResourcePropertyJsonValueConverter(ContextResourcePropertyConverter converter)
Method Detail

toString

public String toString(Object value,
                       ResourcePropertyMapping resourcePropertyMapping,
                       MarshallingContext context)
Description copied from class: SimpleJsonValueConverter
Converst a value to a String. Tryies to infer based on the type and use one of the registered converters based on the given type (in JSON we can have double, int, as well as Strings). Uses ConverterLookup.lookupConverter(Class).

The resulting converter is then used and uses ResourcePropertyConverter.toString(Object, org.compass.core.mapping.ResourcePropertyMapping).

Specified by:
toString in interface ContextResourcePropertyConverter
Overrides:
toString in class ResourcePropertyJsonValueConverter
Parameters:
value - The Object to convert from
resourcePropertyMapping - The resource proeprty mapping
Returns:
The String converted from the Object

fromString

public Object fromString(String str,
                         ResourcePropertyMapping resourcePropertyMapping,
                         MarshallingContext context)
                  throws ConversionException
Description copied from interface: ContextResourcePropertyConverter
Converts from a String and into it's Object representation.

Specified by:
fromString in interface ContextResourcePropertyConverter
Overrides:
fromString in class ResourcePropertyJsonValueConverter
Parameters:
str - The string to convert from
resourcePropertyMapping - The resource property mapping
Returns:
Theh object converterd from the String
Throws:
ConversionException


Copyright (c) 2004-2009 The Compass Project.