y.util
Class ReflectionStringConverter

java.lang.Object
  |
  +--y.util.AbstractStringConverter
        |
        +--y.util.ReflectionStringConverter
All Implemented Interfaces:
ObjectStringConverter

public class ReflectionStringConverter
extends AbstractStringConverter

A simple implementation of an ObjectStringConverter, which uses reflection to construct an object from a String representation and the toString() method to construct the String representation from an object.


Field Summary
 
Fields inherited from class y.util.AbstractStringConverter
forClass
 
Constructor Summary
ReflectionStringConverter(Class forClass)
          Creates a new instance of ReflectionSerializer for the given class type
ReflectionStringConverter(Class forClass, Class nativeType)
          Creates a new instance of ReflectionSerializer for native types
 
Method Summary
protected  Object convertToObject(String o)
          This method must be implemented by subclasses. o will never be the null String
protected  String convertToString(Object o)
          This method must be implemented by subclasses. o will never be the null object.
 
Methods inherited from class y.util.AbstractStringConverter
convertToObject, convertToString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectionStringConverter

public ReflectionStringConverter(Class forClass)
Creates a new instance of ReflectionSerializer for the given class type


ReflectionStringConverter

public ReflectionStringConverter(Class forClass,
                                 Class nativeType)
Creates a new instance of ReflectionSerializer for native types

Method Detail

convertToObject

protected Object convertToObject(String o)
                          throws IllegalArgumentException
Description copied from class: AbstractStringConverter
This method must be implemented by subclasses. o will never be the null String

Specified by:
convertToObject in class AbstractStringConverter
IllegalArgumentException
Parameters:
o - the string representation
Returns:
the created object

convertToString

protected String convertToString(Object o)
                          throws IllegalArgumentException
Description copied from class: AbstractStringConverter
This method must be implemented by subclasses. o will never be the null object.

Specified by:
convertToString in class AbstractStringConverter
IllegalArgumentException
Parameters:
o - the object
Returns:
the String representation

© Copyright 2000-2003,
yWorks GmbH.
All rights reserved.

2003