KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > examples > binding > Property


1 package examples.binding;
2
3 public class Property {
4   public static final int STRING=1;
5   public static final int INTEGER=2;
6   public static final int BEAN=3;
7
8   private String JavaDoc name;
9   private int type;
10   private String JavaDoc refType;
11   public Property(String JavaDoc name,
12                   int type) {
13     this.name = name;
14     this.type = type;
15   }
16   public Property(String JavaDoc name,
17                   int type,
18                   String JavaDoc refType) {
19     this.name = name;
20     this.type = type;
21     this.refType = refType;
22   }
23
24   public String JavaDoc getName() { return name; }
25   public int getType() { return type; }
26   public String JavaDoc getRefType() { return refType; }
27   public String JavaDoc toString() {
28     if (type == STRING) {
29       return "String "+name;
30     } else if (type == INTEGER) {
31       return "Integer "+name;
32     } else {
33       return refType+" "+name;
34     }
35   }
36 }
37
Popular Tags