~sword-devel/jsword/trunk

« back to all changes in this revision

Viewing changes to jsword/java/common/org/crosswire/common/config/NumberChoice.java

  • Committer: joe
  • Date: 2002-10-08 21:36:18 UTC
  • Revision ID: svn-v4:a88caf3b-7e0a-0410-8d0d-cecb45342206:trunk:80
big config and comment update

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
package org.crosswire.common.config;
 
3
 
 
4
import org.crosswire.common.util.Convert;
 
5
 
 
6
/**
 
7
 * A class to convert between strings and objects of a type
 
8
 * 
 
9
 * <p><table border='1' cellPadding='3' cellSpacing='0'>
 
10
 * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
 
11
 *
 
12
 * Distribution Licence:<br />
 
13
 * JSword is free software; you can redistribute it
 
14
 * and/or modify it under the terms of the GNU General Public License,
 
15
 * version 2 as published by the Free Software Foundation.<br />
 
16
 * This program is distributed in the hope that it will be useful,
 
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 
19
 * General Public License for more details.<br />
 
20
 * The License is available on the internet
 
21
 * <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, or by writing to:
 
22
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 
23
 * MA 02111-1307, USA<br />
 
24
 * The copyright to this program is held by it's authors.
 
25
 * </font></td></tr></table>
 
26
 * @see docs.Licence
 
27
 * @author Joe Walker [joe at eireneh dot com]
 
28
 * @version $Id$
 
29
 */
 
30
public class NumberChoice extends ReflectedChoice
 
31
{
 
32
    public Class getConvertionClass()
 
33
    {
 
34
        return Integer.TYPE;
 
35
    }
 
36
 
 
37
    public String convertToString(Object orig)
 
38
    {
 
39
        return Convert.int2String(((Integer) orig).intValue());
 
40
    }
 
41
 
 
42
    public Object convertToObject(String orig)
 
43
    {
 
44
        return new Integer(Convert.string2Int(orig));
 
45
    }
 
46
};