org.castor.cpa.persistence.convertor
Interface TypeConvertor

All Superinterfaces:
java.lang.Cloneable, org.exolab.castor.mapping.TypeConvertor
All Known Implementing Classes:
AbstractTypeConvertor

public interface TypeConvertor
extends org.exolab.castor.mapping.TypeConvertor, java.lang.Cloneable

Interface for a type convertor. A type convertor converts a Java object from one type to another. A type convertor implementation is required for each type of conversion.

Since:
1.1.3
Version:
$Revision: 7134 $ $Date: 2006-04-25 15:08:23 -0600 (Tue, 25 Apr 2006) $
Author:
Ralf Joachim

Method Summary
 java.lang.Object clone()
          Creates and returns a copy of this object.
 void configure(org.castor.core.util.Configuration configuration)
          Configure the converter with given configuration.
 java.lang.Object convert(java.lang.Object object)
          Convert the object from one type to another.
 java.lang.Class fromType()
          Get the type being converted from.
 void parameterize(java.lang.String parameter)
          Initialize the converter with the given parameter.
 java.lang.Class toType()
          Get the type being converted to.
 

Method Detail

configure

public void configure(org.castor.core.util.Configuration configuration)
Configure the converter with given configuration.

Parameters:
configuration - Configuration to use.

parameterize

public void parameterize(java.lang.String parameter)
Initialize the converter with the given parameter. If no parameter is available the method don't need to be called or may be called with null which both should lead to the default behaviour of the converter.

Parameters:
parameter - The parameter for the convertor (null if is not specified).

clone

public java.lang.Object clone()
Creates and returns a copy of this object.

Returns:
A clone of this instance.

fromType

public java.lang.Class fromType()
Get the type being converted from.

Returns:
The type being converted from.

toType

public java.lang.Class toType()
Get the type being converted to.

Returns:
The type being converted to.

convert

public java.lang.Object convert(java.lang.Object object)
                         throws java.lang.ClassCastException
Convert the object from one type to another.

Specified by:
convert in interface org.exolab.castor.mapping.TypeConvertor
Parameters:
object - The object to convert.
Returns:
The converted object.
Throws:
java.lang.ClassCastException - The object is not of the type supported by this convertor.


Copyright 2008 null. All Rights Reserved.