y.util
Interface ObjectStringConverter

All Known Implementing Classes:
AbstractStringConverter, ObjectStringConversion

public interface ObjectStringConverter

Interface for classes which can convert Objects to String representations and vice versa


Method Summary
 Object convertToObject(String o, Class asClass)
          This method takes a String, and tries to interpret it as a String representation of the given classtype, which it will then create.
 String convertToString(Object o, Class asClass)
          This method takes an object, treats it as an object of the given class type and produces a String representation.
 

Method Detail

convertToString

public String convertToString(Object o,
                              Class asClass)
                       throws IllegalArgumentException
This method takes an object, treats it as an object of the given class type and produces a String representation.

Throws:
IllegalArgumentException - if this method is not capable of doing the transformation because of illegal arguments
Parameters:
o - the object to convert
asClass - the type which should be used to interpret the object, may be less specific than the actual object's type
Returns:
a string representation of the object

convertToObject

public Object convertToObject(String o,
                              Class asClass)
                       throws IllegalArgumentException
This method takes a String, and tries to interpret it as a String representation of the given classtype, which it will then create.

Throws:
IllegalArgumentException - if this method is not capable of doing the transformation because of illegal arguments
Parameters:
o - the String to convert
asClass - the type which should be generated by this method. the method is free to create a more specific type, but that type must be assignment compatible
Returns:
an object which can safely be cast to the given type

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

2003