01: /*
02: * FieldInfo.java - part of the CodeAid plugin.
03: * Copyright (C) 1999 Jason Ginchereau
04: *
05: * This program is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU General Public License
07: * as published by the Free Software Foundation; either version 2
08: * of the License, or any later version.
09: *
10: * This program is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13: * GNU General Public License for more details.
14: *
15: * You should have received a copy of the GNU General Public License
16: * along with this program; if not, write to the Free Software
17: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18: */
19:
20: //package codeaid.info;
21: package org.acm.seguin.completer.info;
22:
23: import java.lang.reflect.Field;
24:
25: public final class FieldInfo extends MemberInfo {
26: private String type;
27:
28: public FieldInfo(Field f) {
29: super (f);
30: this .type = f.getType().getName();
31: }
32:
33: public FieldInfo(String declaringClass, int modifiers, String type,
34: String name, String comment) {
35: super (declaringClass, modifiers, name, comment);
36: this .type = type;
37: }
38:
39: public String getType() {
40: return type;
41: }
42:
43: public String getLine() {
44: return modifiersToString(getModifiers()) + getType() + " "
45: + getName();
46: }
47:
48: public int compareTo(MemberInfo mi) {
49: int nc = getName().compareTo(mi.getName());
50: if (nc != 0) {
51: return nc;
52: }
53: if (mi instanceof FieldInfo) {
54: return 0;
55: } else if (mi instanceof ClassInfo) {
56: return 1;
57: } else {
58: return -1;
59: }
60: }
61: }
|