KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > albel > tags > table > model > ColumnType


1 /*
2  * ColumnTypeEnum.java
3  *
4  * Created on Šeštadienis, 2004, Spalio 2, 11.47
5  */

6
7 package albel.tags.table.model;
8
9 /**
10  *
11  * @author Albertas Laurinav
12  */

13 import org.apache.commons.lang.builder.EqualsBuilder;
14
15 public class ColumnType
16 {
17     public static final ColumnType TEXT=new ColumnType("TEXT");
18     public static final ColumnType DELETE=new ColumnType("DELETE");
19     private String JavaDoc type;
20     private ColumnType(String JavaDoc type)
21     {
22         this.type=type;
23     }
24     public static ColumnType getInstance(String JavaDoc type) throws TableTagException
25     {
26         if(!TEXT.getString().equals(type) &&
27             !DELETE.getString().equals(type))
28             throw new TableTagException("Unknown column type "+type);
29         return new ColumnType(type);
30     }
31     public String JavaDoc getString()
32     {
33         return type;
34     }
35     public boolean equals(Object JavaDoc o)
36     {
37         if(!(o instanceof ColumnType))
38             return false;
39         ColumnType ct=(ColumnType)o;
40         return new EqualsBuilder().
41             append(ct.getString(),getString()).
42                 isEquals();
43     }
44 }
Popular Tags