1 6 7 package albel.tags.table.model; 8 9 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 type; 20 private ColumnType(String type) 21 { 22 this.type=type; 23 } 24 public static ColumnType getInstance(String 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 getString() 32 { 33 return type; 34 } 35 public boolean equals(Object 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 |