2733 |
16 Oct 06 |
nicklas |
1 |
/** |
2733 |
16 Oct 06 |
nicklas |
$Id$ |
2733 |
16 Oct 06 |
nicklas |
3 |
|
3675 |
16 Aug 07 |
jari |
Copyright (C) 2006 Nicklas Nordborg |
2733 |
16 Oct 06 |
nicklas |
5 |
|
2733 |
16 Oct 06 |
nicklas |
This file is part of BASE - BioArray Software Environment. |
2733 |
16 Oct 06 |
nicklas |
Available at http://base.thep.lu.se/ |
2733 |
16 Oct 06 |
nicklas |
8 |
|
2733 |
16 Oct 06 |
nicklas |
BASE is free software; you can redistribute it and/or |
2733 |
16 Oct 06 |
nicklas |
modify it under the terms of the GNU General Public License |
4479 |
05 Sep 08 |
jari |
as published by the Free Software Foundation; either version 3 |
2733 |
16 Oct 06 |
nicklas |
of the License, or (at your option) any later version. |
2733 |
16 Oct 06 |
nicklas |
13 |
|
2733 |
16 Oct 06 |
nicklas |
BASE is distributed in the hope that it will be useful, |
2733 |
16 Oct 06 |
nicklas |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
2733 |
16 Oct 06 |
nicklas |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2733 |
16 Oct 06 |
nicklas |
GNU General Public License for more details. |
2733 |
16 Oct 06 |
nicklas |
18 |
|
2733 |
16 Oct 06 |
nicklas |
You should have received a copy of the GNU General Public License |
4515 |
11 Sep 08 |
jari |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
2733 |
16 Oct 06 |
nicklas |
21 |
*/ |
2942 |
22 Nov 06 |
nicklas |
22 |
package net.sf.basedb.util.formatter; |
2733 |
16 Oct 06 |
nicklas |
23 |
|
2733 |
16 Oct 06 |
nicklas |
24 |
/** |
2733 |
16 Oct 06 |
nicklas |
A <code>Formatter</code> formats an object to a string suitable for |
2942 |
22 Nov 06 |
nicklas |
output in a client application. The formatter may optionally also do |
2942 |
22 Nov 06 |
nicklas |
the reverse, ie. parse a string to an object. |
2733 |
16 Oct 06 |
nicklas |
28 |
|
2733 |
16 Oct 06 |
nicklas |
@author nicklas |
2733 |
16 Oct 06 |
nicklas |
@version 2.0 |
2733 |
16 Oct 06 |
nicklas |
@base.modified $Date$ |
2733 |
16 Oct 06 |
nicklas |
32 |
*/ |
2733 |
16 Oct 06 |
nicklas |
33 |
public interface Formatter<T> |
2733 |
16 Oct 06 |
nicklas |
34 |
{ |
2733 |
16 Oct 06 |
nicklas |
35 |
|
2733 |
16 Oct 06 |
nicklas |
36 |
/** |
2733 |
16 Oct 06 |
nicklas |
Format a value by converting it to a string. |
2733 |
16 Oct 06 |
nicklas |
@param value The value to format |
2733 |
16 Oct 06 |
nicklas |
@return A formatted string |
2733 |
16 Oct 06 |
nicklas |
40 |
*/ |
2733 |
16 Oct 06 |
nicklas |
41 |
public String format(T value); |
2733 |
16 Oct 06 |
nicklas |
42 |
|
2942 |
22 Nov 06 |
nicklas |
43 |
/** |
5432 |
29 Sep 10 |
nicklas |
Parse a string and return a value of the correct type. A null |
5432 |
29 Sep 10 |
nicklas |
input string should (unless otherwise documented by a specific |
5432 |
29 Sep 10 |
nicklas |
formatter implementation) be allowed and may return null or |
5432 |
29 Sep 10 |
nicklas |
any other "default" value. |
5432 |
29 Sep 10 |
nicklas |
48 |
|
2942 |
22 Nov 06 |
nicklas |
@param value The string to parse |
2942 |
22 Nov 06 |
nicklas |
@return An object |
2942 |
22 Nov 06 |
nicklas |
@since 2.2 |
2942 |
22 Nov 06 |
nicklas |
52 |
*/ |
2942 |
22 Nov 06 |
nicklas |
53 |
public T parseString(String value); |
2942 |
22 Nov 06 |
nicklas |
54 |
|
2733 |
16 Oct 06 |
nicklas |
55 |
} |