1 package com.daffodilwoods.daffodildb.utils.field; 2 3 import com.daffodilwoods.daffodildb.utils.BufferRange; 4 import com.daffodilwoods.database.resource.DException; 5 import com.daffodilwoods.daffodildb.utils._DComparator; 6 import java.text.Collator ; 7 8 public abstract class FieldBase implements _DComparator { 9 public BufferRange bufferRange; 10 protected int datatype = -1; 11 public Object object; 12 13 protected Collator collator; 14 15 public FieldBase() { 16 } 17 18 public FieldBase(BufferRange bufferRange0, int datatype0) { 19 bufferRange = bufferRange0; 20 datatype = datatype0; 21 } 22 23 public FieldBase(Object object0, int datatype0) { 24 object = object0; 25 datatype = datatype0; 26 } 27 28 public int getDatatype() throws DException { 29 return datatype; 30 } 31 32 public void setDatatype(int type) throws DException { 33 datatype = type; 34 } 35 36 public void setSize(int size) throws DException { 37 } 38 39 public int getSize() throws DException { 40 return 0; 41 } 42 43 public BufferRange getBufferRange() { 44 return bufferRange; 45 } 46 47 public void setBufferRange(BufferRange range) { 48 bufferRange = range; 49 50 object=null; 51 } 52 53 54 public void setObject(Object object0) { 55 object = object0; 56 } 57 58 public abstract Object getObject() throws DException; 59 60 public String toString() { 61 try { 62 return getObject().toString(); 63 } catch (Exception ex) { 64 return "null"; 65 } 66 } 67 68 public boolean getNull() { 69 return bufferRange.getNull(); 70 } 71 72 public byte getByte(int index) { 73 return bufferRange.getByte(index); 74 } 75 76 public byte[] getBytes() { 77 return bufferRange.getBytes(); 78 } 79 80 public int getLength() { 81 return bufferRange.getLength(); 82 } 83 84 public boolean isNull() { 85 return bufferRange.getNull(); 86 } 87 88 public void setCollator(Collator collator0) { 89 collator = collator0; 90 } 91 92 public Collator getCollator() { 93 return collator; 94 } 95 96 } 97 | Popular Tags |