KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > utils > field > FieldBase


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 JavaDoc;
7
8 public abstract class FieldBase implements _DComparator /*, java.io.Serializable { //Done on 04- Feb- 2005 as suggested by Parveen Sir }*/ {
9    public BufferRange bufferRange;
10    protected int datatype = -1;
11    public Object JavaDoc object;
12
13    protected Collator JavaDoc 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 JavaDoc 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 JavaDoc object0) {
55       object = object0;
56    }
57
58    public abstract Object JavaDoc getObject() throws DException;
59
60    public String JavaDoc toString() {
61       try {
62          return getObject().toString();
63       } catch (Exception JavaDoc 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 JavaDoc collator0) {
89       collator = collator0;
90    }
91
92    public Collator JavaDoc getCollator() {
93       return collator;
94    }
95
96 }
97
Popular Tags