1 package dinamica; 2 3 import java.io.Serializable ; 4 import java.text.MessageFormat ; 5 import java.util.HashMap ; 6 7 16 public class Record implements Serializable 17 { 18 19 22 private static final long serialVersionUID = 1L; 23 24 25 HashMap _record = new HashMap (); 26 27 28 Recordset _children = null; 29 30 34 public Record(HashMap values) 35 { 36 _record = values; 37 } 38 39 46 public Object getFieldValue(String fieldName) throws RecordsetException 47 { 48 49 if (!_record.containsKey(fieldName)) 50 { 51 String args[] = {fieldName}; 52 String msg = Errors.FIELD_NOT_FOUND; 53 msg = MessageFormat.format(msg, args); 54 throw new RecordsetException(msg); 55 } 56 return _record.get(fieldName); 57 58 } 59 60 66 public void setValue(String fieldName, Object value) throws RecordsetException 67 { 68 if (!_record.containsKey(fieldName)) 69 { 70 String args[] = {fieldName}; 71 String msg = Errors.FIELD_NOT_FOUND; 72 msg = MessageFormat.format(msg, args); 73 throw new RecordsetException(msg); 74 } 75 76 _record.put(fieldName, value ); 77 78 } 79 80 84 public void setChildren(Recordset rs) 85 { 86 _children = rs; 87 } 88 89 93 public Recordset getChildren() 94 { 95 return _children; 96 } 97 98 102 public Record() 103 { 104 } 105 106 } 107 | Popular Tags |