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.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
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
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 contentHandlerlocale
- The locale
- Throws:
SAXException
- Just in case of failure that could never happen
Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.