Advertisement
Guest User

Untitled

a guest
Apr 18th, 2013
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.02 KB | None | 0 0
  1. public class Customer extends Record {
  2.     private static final String TABLE = "customers";
  3.     private static final List<ColumnInfo> COLUMNS;
  4.     static {
  5.         final List<ColumnInfo> columns = new ArrayList<ColumnInfo>();
  6.         columns.add(new ColumnInfo("name", "text"));
  7.         columns.add(new ColumnInfo("phone", "text"));
  8.         columns.add(new ColumnInfo("phone", "text"));
  9.         columns.add(new ColumnInfo("address", "text"));
  10.         columns.add(new ColumnInfo("notes", "text"));
  11.        
  12.         COLUMNS = Collections.unmodifiableList(columns);
  13.     }
  14.    
  15.     @Override
  16.     public String getTable() {
  17.         return TABLE;
  18.     }
  19.    
  20.     @Override
  21.     public List<ColumnInfo> getColumns() {
  22.         return COLUMNS;
  23.     }
  24.    
  25.     @Override
  26.     public String toString() {
  27.         return getValue("name");
  28.     }
  29. }
  30.  
  31. public class ColumnInfo {
  32.     private final String name;
  33.     private final String type;
  34.    
  35.     public ColumnInfo(final String name, final String type) {
  36.         this.name = name;
  37.         this.type = type;
  38.     }
  39.    
  40.     public String getName() {
  41.         return name;
  42.     }
  43.    
  44.     public String getType() {
  45.         return type;
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement