01: /*
02: * @(#) ObjectConverter.java
03: *
04: * Copyright 2002 - 2003 JIDE Software. All rights reserved.
05: */
06: package com.jidesoft.converter;
07:
08: /**
09: * An interface that can convert a object to a String and convert from
10: * String to object.
11: */
12: public interface ObjectConverter {
13:
14: /**
15: * Converts from object to String based on current locale.
16: *
17: * @param object object to be converted
18: * @param context converter context to be used
19: * @return the String
20: */
21: abstract String toString(Object object, ConverterContext context);
22:
23: /**
24: * If it supports toString method.
25: *
26: * @param object object to be converted
27: * @param context converter context to be used
28: * @return true if supports toString
29: */
30: abstract boolean supportToString(Object object,
31: ConverterContext context);
32:
33: /**
34: * Converts from String to an object.
35: *
36: * @param string the string
37: * @param context context to be converted
38: * @return the object converted from string
39: */
40: abstract Object fromString(String string, ConverterContext context);
41:
42: /**
43: * If it supports fromString.
44: *
45: * @param string the string
46: * @param context context to be converted
47: * @return true if it supports
48: */
49: abstract boolean supportFromString(String string,
50: ConverterContext context);
51: }
|