org.codehaus.groovy.grails.web.converters.configuration
Class DefaultConverterConfiguration<C extends Converter>

java.lang.Object
  extended by org.codehaus.groovy.grails.web.converters.configuration.DefaultConverterConfiguration<C>
All Implemented Interfaces:
ConverterConfiguration<C>

public class DefaultConverterConfiguration<C extends Converter>
extends Object
implements ConverterConfiguration<C>

Mutable Converter Configuration with an priority sorted set of ObjectMarshallers

Since:
1.1
Author:
Siegfried Puchbauer

Nested Class Summary
 class DefaultConverterConfiguration.Entry
           
 
Field Summary
static int DEFAULT_PRIORITY
           
 
Constructor Summary
DefaultConverterConfiguration()
           
DefaultConverterConfiguration(ConverterConfiguration<C> delegate)
           
DefaultConverterConfiguration(ConverterConfiguration<C> delegate, ProxyHandler proxyHandler)
           
DefaultConverterConfiguration(List<ObjectMarshaller<C>> oms)
           
DefaultConverterConfiguration(List<ObjectMarshaller<C>> oms, ProxyHandler proxyHandler)
           
DefaultConverterConfiguration(ProxyHandler proxyHandler)
           
 
Method Summary
 Converter.CircularReferenceBehaviour getCircularReferenceBehaviour()
          Lookup the configured CircularReferenceBehaviour (how the converter should behave when a circular reference is detected)
 String getEncoding()
          Lookup the configured default Character encoding for the Converter
 ObjectMarshaller<C> getMarshaller(Object o)
          Lookup the ObjectMarshaller with the highest priority that support to marshall the given object
 List<ObjectMarshaller<C>> getOrderedObjectMarshallers()
          Retrieve the ordered list of ObjectMarshallers
 ProxyHandler getProxyHandler()
          Lookup the ProxyHandler used to deal with proxies instances
 boolean isPrettyPrint()
          Lookup method whether the converter should default to pretty printed output
 void registerObjectMarshaller(Class c, groovy.lang.Closure callable)
           
 void registerObjectMarshaller(Class c, int priority, groovy.lang.Closure callable)
           
 void registerObjectMarshaller(ObjectMarshaller<C> marshaller)
           
 void registerObjectMarshaller(ObjectMarshaller<C> marshaller, int priority)
           
 void setCircularReferenceBehaviour(Converter.CircularReferenceBehaviour circularReferenceBehaviour)
           
 void setEncoding(String encoding)
           
 void setPrettyPrint(boolean prettyPrint)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PRIORITY

public static final int DEFAULT_PRIORITY
See Also:
Constant Field Values
Constructor Detail

DefaultConverterConfiguration

public DefaultConverterConfiguration()

DefaultConverterConfiguration

public DefaultConverterConfiguration(ConverterConfiguration<C> delegate)

DefaultConverterConfiguration

public DefaultConverterConfiguration(ProxyHandler proxyHandler)

DefaultConverterConfiguration

public DefaultConverterConfiguration(ConverterConfiguration<C> delegate,
                                     ProxyHandler proxyHandler)

DefaultConverterConfiguration

public DefaultConverterConfiguration(List<ObjectMarshaller<C>> oms)

DefaultConverterConfiguration

public DefaultConverterConfiguration(List<ObjectMarshaller<C>> oms,
                                     ProxyHandler proxyHandler)
Method Detail

getEncoding

public String getEncoding()
Description copied from interface: ConverterConfiguration
Lookup the configured default Character encoding for the Converter

Specified by:
getEncoding in interface ConverterConfiguration<C extends Converter>
Returns:
the Charset name

setEncoding

public void setEncoding(String encoding)

getCircularReferenceBehaviour

public Converter.CircularReferenceBehaviour getCircularReferenceBehaviour()
Description copied from interface: ConverterConfiguration
Lookup the configured CircularReferenceBehaviour (how the converter should behave when a circular reference is detected)

Specified by:
getCircularReferenceBehaviour in interface ConverterConfiguration<C extends Converter>
Returns:
an instance of CircularReferenceBehaviour
See Also:
Converter.CircularReferenceBehaviour

isPrettyPrint

public boolean isPrettyPrint()
Description copied from interface: ConverterConfiguration
Lookup method whether the converter should default to pretty printed output

Specified by:
isPrettyPrint in interface ConverterConfiguration<C extends Converter>
Returns:
a boolean

setPrettyPrint

public void setPrettyPrint(boolean prettyPrint)

getOrderedObjectMarshallers

public List<ObjectMarshaller<C>> getOrderedObjectMarshallers()
Description copied from interface: ConverterConfiguration
Retrieve the ordered list of ObjectMarshallers

Specified by:
getOrderedObjectMarshallers in interface ConverterConfiguration<C extends Converter>
Returns:
the List of ObjectMarshallers ordered by priority

setCircularReferenceBehaviour

public void setCircularReferenceBehaviour(Converter.CircularReferenceBehaviour circularReferenceBehaviour)

registerObjectMarshaller

public void registerObjectMarshaller(ObjectMarshaller<C> marshaller)

registerObjectMarshaller

public void registerObjectMarshaller(ObjectMarshaller<C> marshaller,
                                     int priority)

registerObjectMarshaller

public void registerObjectMarshaller(Class c,
                                     int priority,
                                     groovy.lang.Closure callable)

registerObjectMarshaller

public void registerObjectMarshaller(Class c,
                                     groovy.lang.Closure callable)

getMarshaller

public ObjectMarshaller<C> getMarshaller(Object o)
Description copied from interface: ConverterConfiguration
Lookup the ObjectMarshaller with the highest priority that support to marshall the given object

Specified by:
getMarshaller in interface ConverterConfiguration<C extends Converter>
Parameters:
o - the object which is about to be converted
Returns:
the ObjectMarshaller instance

getProxyHandler

public ProxyHandler getProxyHandler()
Description copied from interface: ConverterConfiguration
Lookup the ProxyHandler used to deal with proxies instances

Specified by:
getProxyHandler in interface ConverterConfiguration<C extends Converter>
Returns:
The proxy handler


Copyright (c) 2005-2009 The Grails project