Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.directwebremoting.extend
Interface Converter

All Known Subinterfaces:
  NamedConverter

All Known Implementing Classes:
  ArrayConverter, BaseV10Converter, BaseV20Converter, BasicObjectConverter, BeanConverter, BigNumberConverter, CharArrayConverter, CollectionConverter, ConstructorConverter, DateConverter, DOM4JConverter, DOMConverter, EnumConverter, ExceptionConverter, H2BeanConverter, H3BeanConverter, JDOMConverter, MapConverter, MinimalistExceptionConverter, NullConverter, ObjectConverter, PrimitiveConverter, ServletConverter, StringConverter, URLConverter, XOMConverter

    public interface Converter

An interface for converting types from a string to some other type.

Author:
  Joe Walker [joe at getahead dot ltd dot uk]

Method Summary
`java.lang.Object` | `convertInbound(java.lang.Class paramType, InboundVariable data, InboundContext inctx)` Attempt to coerce the data from a string to an Object.
`OutboundVariable` | `convertOutbound(java.lang.Object data, OutboundContext outctx)` Return a javascript string that defines the variable named varName to have the contents of the converted object data.
`void` | `setConverterManager(ConverterManager config)` If we are a compound converter that farms out part of the conversion to other converters then you farm the conversion out via a configuration.

Method Detail

### setConverterManager

    void setConverterManager(ConverterManager config)

  If we are a compound converter that farms out part of the conversion to other converters then you farm the conversion out via a configuration.

  Parameters:
    `config` - The confiuration object

### convertInbound

    java.lang.Object convertInbound(java.lang.Class paramType,
                                    InboundVariable data,
                                    InboundContext inctx)
                                    throws MarshallException

  Attempt to coerce the data from a string to an Object. If anything goes wrong with inbound conversion then we generally throw an exception because we are converting data from the untrusted internet so we take the assumption that anything wrong is someone hacking.

  Parameters:
    `paramType` - The type to convert to
    `data` - The data to convert
    `inctx` - The map of data that we are working on
  Returns:
    The convered data, or null if the conversion was not possible
  Throws:
    `MarshallException` - If the conversion failed for some reason

### convertOutbound

    OutboundVariable convertOutbound(java.lang.Object data,
                                     OutboundContext outctx)
                                     throws MarshallException

  Return a javascript string that defines the variable named varName to have the contents of the converted object data.

  In contrast to `convertInbound()` failures in converting data on the way out should not stop processing, and we should carry on if we can. Failures are probably down to some misconfiguration so as much information about the error as can be safely generated to console logs is good. In other words if you need to loop in outbound conversion then it might be a good idea to catch issues inside the loop, log, and carry on.

  Parameters:
    `data` - The data to convert
    `outctx` - A collection of objects already converted and the results
  Returns:
    The OutboundVariable that represents the data to convert
  Throws:
    `MarshallException` - If the conversion failed for some reason

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ¬ 2005
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD