1 package com.quadcap.sql; 2 3 40 41 import java.io.Externalizable ; 42 import java.io.IOException ; 43 import java.io.ObjectInput ; 44 import java.io.ObjectOutput ; 45 46 51 public class SelectItem implements Externalizable { 52 Expression e; 53 public String asName = null; 54 55 public SelectItem() {} 56 57 public SelectItem(Expression e) { 58 this.e = e; 59 } 60 61 public void setAs(String asName) { 62 this.asName = asName; 63 } 64 65 public Expression getExpression() { return e; } 66 public String getAsName() { return asName; } 67 68 public void readExternal(ObjectInput in) 69 throws IOException , ClassNotFoundException 70 { 71 e = (Expression)in.readObject(); 72 asName = (String )in.readObject(); 73 } 74 75 public void writeExternal(ObjectOutput out) throws IOException { 76 out.writeObject(e); 77 out.writeObject(asName); 78 } 79 80 public String toString() { 81 StringBuffer sb = new StringBuffer (e.toString()); 82 if (asName != null) { 83 sb.append(" AS "); 84 sb.append(asName); 85 } 86 return sb.toString(); 87 } 88 } 89 | Popular Tags |