Make List type safe. Remove/suppress all warnings.
[marc4j.git] / src / org / marc4j / marc / impl / VariableFieldImpl.java
1 // $Id: VariableFieldImpl.java,v 1.4 2006/08/04 12:29:16 bpeters Exp $\r
2 /**\r
3  * Copyright (C) 2004 Bas Peters\r
4  *\r
5  * This file is part of MARC4J\r
6  *\r
7  * MARC4J is free software; you can redistribute it and/or\r
8  * modify it under the terms of the GNU Lesser General Public \r
9  * License as published by the Free Software Foundation; either \r
10  * version 2.1 of the License, or (at your option) any later version.\r
11  *\r
12  * MARC4J is distributed in the hope that it will be useful,\r
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
15  * Lesser General Public License for more details.\r
16  *\r
17  * You should have received a copy of the GNU Lesser General Public \r
18  * License along with MARC4J; if not, write to the Free Software\r
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
20  */\r
21 package org.marc4j.marc.impl;\r
22 \r
23 import org.marc4j.marc.VariableField;\r
24 \r
25 /**\r
26  * Represents a variable field in a MARC record.\r
27  * \r
28  * @author Bas Peters\r
29  * @version $Revision: 1.4 $\r
30  */\r
31 public abstract class VariableFieldImpl implements VariableField {\r
32 \r
33     /**\r
34      * \r
35      */\r
36     private static final long serialVersionUID = -1946945669891526509L;\r
37     private String tag;\r
38 \r
39     /**\r
40      * Creates a new <code>VariableField</code>.\r
41      */\r
42     public VariableFieldImpl() {\r
43     }\r
44 \r
45     /**\r
46      * Creates a new <code>VariableField</code> and sets the tag name.\r
47      */\r
48     public VariableFieldImpl(String tag) {\r
49         this.setTag(tag);\r
50     }\r
51 \r
52     public void setTag(String tag) {\r
53         this.tag = tag;\r
54     }\r
55 \r
56     public String getTag() {\r
57         return tag;\r
58     }\r
59     \r
60     public int compareTo(Object obj) {\r
61         if (!(obj instanceof VariableFieldImpl))\r
62             throw new ClassCastException("A VariableField object expected");\r
63 \r
64         VariableField field = (VariableField) obj;\r
65         return tag.compareTo(field.getTag());\r
66     }\r
67 \r
68     /**\r
69      * Returns a string representation of this variable field.\r
70      * \r
71      * @return String - a string representation of this variable field\r
72      */\r
73     public String toString() {\r
74         return tag;\r
75     }\r
76 \r
77 }