Source code: com/flexstor/common/data/ejb/disguiserecord/DisguiseFieldRecordData.java
1 /*
2 * DisguiseFieldRecordData.java
3 *
4 * Copyright $Date: 2003/08/11 02:22:28 $ FLEXSTOR.net Inc.
5 *
6 * This work is licensed for use and distribution under license terms found at
7 * http://www.flexstor.org/license.html
8 *
9 */
10
11 package com.flexstor.common.data.ejb.disguiserecord;
12
13 import java.util.Vector;
14
15 import com.flexstor.common.data.ejb.Data;
16
17 /**
18 * DisguiseFieldRecordData is a class that Holds the data for a bucket record.
19 *
20 *
21 * @author Wei Tang
22 * @version 1.0, 05/11/99
23 *
24 * @see com.flexstor.
25 * @see com.flexstor.
26 *
27 * @since FLEXSTOR.db 3.0
28 *
29 * Revision History Description of Change
30 * ---------------- ---------------------------------------------------
31 * WT 05/11/99 Creation
32 */
33 public class DisguiseFieldRecordData
34 extends Data
35 {
36 /**
37 * Could be a collection of values. Therefore, the value column should
38 * be treated like a linked list.
39 */
40 protected Vector vValues = null;
41
42 public DisguiseFieldRecordData() {}
43
44 public DisguiseFieldRecordData( String[] saValues )
45 {
46 setValues(saValues);
47 }
48
49 public DisguiseFieldRecordData( String sValue )
50 {
51 addValue(sValue);
52 }
53
54 public String getValue()
55 {
56 if ( vValues != null && vValues.size() > 0 )
57 return (String) vValues.elementAt(0);
58 else
59 return null;
60 }
61
62 public String[] getValues()
63 {
64 if ( vValues != null && vValues.size() > 0 )
65 {
66 String[] sValues = new String[ vValues.size() ];
67 vValues.copyInto( sValues );
68 return sValues;
69 }
70 else
71 return null;
72 }
73
74 public boolean setValues( String[] sValues )
75 {
76 if ( sValues != null && sValues.length > 0 )
77 {
78 vValues = new Vector();
79 for ( int i = 0; i < sValues.length; i++ )
80 vValues.addElement( sValues[i] );
81
82 return true;
83 }
84 return false;
85 }
86
87 public void addValue( String sValue )
88 {
89 if (vValues == null)
90 vValues = new Vector();
91
92 vValues.addElement( sValue );
93 }
94 }
95