org.pm4j.core.pm.impl.converter
Class PmConverterSerializeableBase<T extends java.io.Serializable>

java.lang.Object
  extended by org.pm4j.core.pm.impl.converter.PmConverterSerializeableBase<T>
Type Parameters:
T - Type of the value to convert.
All Implemented Interfaces:
PmAttr.Converter<T>
Direct Known Subclasses:
PmConverterBoolean, PmConverterDate, PmConverterNumber, PmConverterString

public abstract class PmConverterSerializeableBase<T extends java.io.Serializable>
extends java.lang.Object
implements PmAttr.Converter<T>

Base class for converters that handle Serializable values.

Provides simple base implementations for some PmAttr.Converter methods.

Author:
olaf boede

Constructor Summary
PmConverterSerializeableBase()
           
 
Method Summary
 T serializeableToValue(PmAttr<?> pmAttr, java.io.Serializable s)
          Casts the given value to T.
 java.io.Serializable valueToSerializable(PmAttr<?> pmAttr, T v)
          Passes the given value object through.
 java.lang.String valueToString(PmAttr<?> pmAttr, T v)
          Just calls the Object.toString() method of the given value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.pm4j.core.pm.PmAttr.Converter
stringToValue
 

Constructor Detail

PmConverterSerializeableBase

public PmConverterSerializeableBase()
Method Detail

valueToString

public java.lang.String valueToString(PmAttr<?> pmAttr,
                                      T v)
Just calls the Object.toString() method of the given value.

This solution works if the Object.toString() implementation provides the information needed for the PmAttr.Converter.stringToValue(PmAttr, String) method call.

Specified by:
valueToString in interface PmAttr.Converter<T extends java.io.Serializable>

valueToSerializable

public java.io.Serializable valueToSerializable(PmAttr<?> pmAttr,
                                                T v)
Passes the given value object through.

Specified by:
valueToSerializable in interface PmAttr.Converter<T extends java.io.Serializable>

serializeableToValue

public T serializeableToValue(PmAttr<?> pmAttr,
                              java.io.Serializable s)
Casts the given value to T.

Specified by:
serializeableToValue in interface PmAttr.Converter<T extends java.io.Serializable>