org.compass.core.converter
Interface Converter

All Known Subinterfaces:
DelegateConverter, DynamicConverter, FormatConverter, ResourceMappingConverter, ResourcePropertyConverter
All Known Implementing Classes:
AbstractBasicConverter, AbstractCollectionMappingConverter, AbstractDynamicConverter, AbstractDynamicJsonMappingConverter, AbstractFormatConverter, AbstractJsonObjectMappingConverter, AbstractNumberConverter, AbstractRefAliasMappingConverter, ArrayMappingConverter, AtomicBooleanConverter, AtomicIntConverter, AtomicLongConverter, BigDecimalConverter, BigIntegerConverter, BooleanConverter, ByteConverter, CalendarConverter, CharConverter, ClassMappingConverter, ClassPropertyMappingConverter, CollectionMappingConverter, ComponentMappingConverter, ConstantMappingConverter, DateConverter, DoubleConverter, EnumConverter, FileConverter, FloatConverter, FormatDelegateConverter, GroovyDynamicConverter, InputStreamConverter, IntConverter, JakartaElDynamicConverter, JexlDynamicConverter, JsonArrayMappingConverter, JsonContentMappingConverter, JsonIdMappingConverter, JsonPropertyMappingConverter, LocaleConverter, LongConverter, MVELDynamicConverter, ObjectByteArrayConverter, OgnlDynamicConverter, ParentMappingConverter, PlainCascadeMappingConverter, PlainJsonObjectMappingConverter, PrimitiveByteArrayConverter, RawResourceMappingConverter, ReaderConverter, ReferenceMappingConverter, ResourcePropertyJsonValueConverter, ResourcePropertyValueConverter, RootJsonObjectMappingConverter, ShortConverter, SimpleJsonValueConverter, SimpleXmlValueConverter, SqlDateConverter, SqlTimeConverter, SqlTimestampConverter, StringBufferConverter, StringBuilderConverter, StringConverter, URIConverter, URLConverter, VelocityDynamicConverter, XmlContentMappingConverter, XmlIdMappingConverter, XmlObjectMappingConverter, XmlPropertyMappingConverter

public interface Converter

A converter is responsible for performing conversion between the actual object and the resource. Must be thread safe.

Author:
kimchy

Method Summary
 boolean marshall(Resource resource, Object root, Mapping mapping, MarshallingContext context)
          Marshall the given Object to the given Resource.
 Object unmarshall(Resource resource, Mapping mapping, MarshallingContext context)
          Unmarshall the given Resource to the appropiate Object.
 

Method Detail

marshall

boolean marshall(Resource resource,
                 Object root,
                 Mapping mapping,
                 MarshallingContext context)
                 throws ConversionException
Marshall the given Object to the given Resource. Will use the mapping definition as to how to marshall the object.

Returns true if data was saved in the index, and it can be read as well (i.e. stored).

Parameters:
resource - The resource to marhsall the object to
root - The Object to marshall to the resource
mapping - The mapping definition of how to marshall the Object to the resoruce
context - The context for the current marhslling process
Returns:
true if data was saved in the the index that can be read.
Throws:
ConversionException

unmarshall

Object unmarshall(Resource resource,
                  Mapping mapping,
                  MarshallingContext context)
                  throws ConversionException
Unmarshall the given Resource to the appropiate Object.

Parameters:
resource - The resource to unmarshall into an Object
mapping - The mapping definition of how to unmarshall the Resource into an Object
context - The context for the current marshalling process
Returns:
The object unmarshalled
Throws:
ConversionException


Copyright (c) 2004-2008 The Compass Project.