org.codehaus.groovy.grails.web.converters.marshaller
Class ClosureOjectMarshaller<T extends Converter>

java.lang.Object
  extended by org.codehaus.groovy.grails.web.converters.marshaller.ClosureOjectMarshaller<T>
All Implemented Interfaces:
ObjectMarshaller<T>

public class ClosureOjectMarshaller<T extends Converter>
extends Object
implements ObjectMarshaller<T>

ObjectMarshaller that delegates the conversion logic to the supplied closure

Since:
1.1
Author:
Siegfried Puchbauer

Constructor Summary
ClosureOjectMarshaller(Class<?> clazz, groovy.lang.Closure closure)
           
 
Method Summary
 void marshalObject(Object object, T converter)
          Performs the conversion
 boolean supports(Object object)
          Checks wheter the ObjectMarshaller is able/intended to support the given Object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClosureOjectMarshaller

public ClosureOjectMarshaller(Class<?> clazz,
                              groovy.lang.Closure closure)
Method Detail

supports

public boolean supports(Object object)
Description copied from interface: ObjectMarshaller
Checks wheter the ObjectMarshaller is able/intended to support the given Object

Specified by:
supports in interface ObjectMarshaller<T extends Converter>
Parameters:
object - the object which is about getting converted
Returns:
true if the marshaller can/should perform the marshalling, false otherwise

marshalObject

public void marshalObject(Object object,
                          T converter)
                   throws ConverterException
Description copied from interface: ObjectMarshaller
Performs the conversion

Specified by:
marshalObject in interface ObjectMarshaller<T extends Converter>
Parameters:
object - the object which is about getting converted
converter - the Converter to use
Throws:
ConverterException - on failure