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.apache.cocoon.forms.datatype.convertor
Class BeanConvertor

    java.lang.Object
      org.apache.cocoon.forms.datatype.convertor.BeanConvertor

All Implemented Interfaces:
  Convertor

public class BeanConvertor
extends Object
implements Convertor

Converts String representation of beans to bean instances and vice versa.

Sometimes the toString() method doesn't give a good representation of a Java Bean suited for selection list IDs. For this an optional <fd:id-path>jx-path</fd:id-path> attribute can be specified to have this convertor to use a different string representation.

Version:
  $Id: BeanConvertor.java 587759 2007-10-24 03:00:37Z vgritsenko $

Nested Class Summary

Nested classes inherited from class org.apache.cocoon.forms.datatype.convertor.Convertor
`Convertor.FormatCache`

Constructor Summary
`BeanConvertor(String className, String idPath)` Construct a new BeanConvertor for a class

Method Summary
`ConversionResult` | `convertFromString(String value, Locale locale, Convertor.FormatCache formatCache)` Converts string representation into the object of convertor's type.
`String` | `convertToString(Object value, Locale locale, Convertor.FormatCache formatCache)`
`void` | `generateSaxFragment(ContentHandler contentHandler, Locale locale)` We do not enerate any SAX events
`Class` | `getTypeClass()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BeanConvertor

    public BeanConvertor(String className,
                         String idPath)

  Construct a new BeanConvertor for a class

Parameters:
  `className` - The package-qualified name of the class implementing the typesafe enum pattern.
  `idPath` - Path to the identity field of the bean
Throws:
  `CascadingRuntimeException` - If the class cannot be found

Method Detail

### getTypeClass

    public Class getTypeClass()

  Specified by:
    `getTypeClass` in interface `Convertor`
  See Also:
    `Convertor.getTypeClass()`

### convertFromString

    public ConversionResult convertFromString(String value,
                                              Locale locale,
                                              Convertor.FormatCache formatCache)

  Description copied from interface: `Convertor`
  Converts string representation into the object of convertor's type.

  Specified by:
    `convertFromString` in interface `Convertor`
  Parameters:
    `formatCache` - can be null if not needed
  See Also:
    `Convertor.convertFromString(java.lang.String, java.util.Locale, org.apache.cocoon.forms.datatype.convertor.Convertor.FormatCache)`

### convertToString

    public String convertToString(Object value,
                                  Locale locale,
                                  Convertor.FormatCache formatCache)

  Specified by:
    `convertToString` in interface `Convertor`
  See Also:
    `Convertor.convertToString(java.lang.Object, java.util.Locale, org.apache.cocoon.forms.datatype.convertor.Convertor.FormatCache)`

### generateSaxFragment

    public void generateSaxFragment(ContentHandler contentHandler,
                                    Locale locale)
                             throws SAXException

  We do not enerate any SAX events

  Specified by:
    `generateSaxFragment` in interface `Convertor`
  Parameters:
    `contentHandler` - The contentHandler
    `locale` - The locale
  Throws:
    `SAXException` - Just in case of failure that could never happen

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

Copyright © 1999-2008 The Apache Software Foundation. All Rights Reserved.