1 package com.loribel.commons.abstraction;
2
3 import com.loribel.commons.exception.*;
4
5 /***
6 * Interface for object that can convert value to String.
7 *
8 * @author Gregory Borelli
9 */
10 public interface GB_StringConvertor
11 {
12 /***
13 * Parses String to produce corresponding object.
14 *
15 * @param a_string String - the string to parse
16 *
17 * @return Object
18 */
19 Object stringAsValue(
20 String a_string)
21 throws GB_ConvertorException;
22
23 /***
24 * Parses String to produce corresponding object.
25 * Exception free. Return null if exception occured.
26 *
27 * @param a_string String - the string to parse
28 *
29 * @return Object
30 */
31 Object stringAsValueSafe(
32 String a_string);
33
34 /***
35 * Returns true if the convertor supports the stringAsValue() operation.
36 *
37 * @return boolean
38 */
39 boolean supportsStringAsValue();
40
41 /***
42 * Formats object into <tt>String</tt>.
43 *
44 * @param a_value Object -
45 *
46 * @return String
47 */
48 String valueAsString(
49 Object a_value)
50 throws GB_ConvertorException;
51
52 }