01: // $Id: BeanMap.java 7 2007-08-17 19:32:18Z jcamaia $
02:
03: package net.sf.persist.tests.framework;
04:
05: import java.util.ArrayList;
06: import java.util.List;
07:
08: /**
09: * Holds all data necessary to build a bean during runtime and metadata to test it
10: */
11: public class BeanMap {
12:
13: private String className;
14: private String schema;
15: private List<FieldMap> fields;
16: private boolean supportsAutoGeneratedKeys = true;
17:
18: public BeanMap(String className) {
19: this .className = className;
20: this .fields = new ArrayList();
21: }
22:
23: public String getClassName() {
24: return className;
25: }
26:
27: public List<FieldMap> getFields() {
28: return fields;
29: }
30:
31: public void setFields(List<FieldMap> fields) {
32: this .fields = fields;
33: }
34:
35: public BeanMap addField(FieldMap fieldMap) {
36: fields.add(fieldMap);
37: return this ;
38: }
39:
40: public FieldMap getField(String fieldName) {
41: for (FieldMap fieldMap : fields) {
42: if (fieldMap.getFieldName().equals(fieldName))
43: return fieldMap;
44: }
45: return null;
46: }
47:
48: public BeanMap setClassName(String className) {
49: this .className = className;
50: return this ;
51: }
52:
53: public String getSchema() {
54: return schema;
55: }
56:
57: public BeanMap setSchema(String schema) {
58: this .schema = schema;
59: return this ;
60: }
61:
62: public boolean supportsAutoGeneratedKeys() {
63: return this .supportsAutoGeneratedKeys;
64: }
65:
66: public BeanMap setSupportsAutoGeneratedKeys(
67: boolean supportsAutoGeneratedKeys) {
68: this.supportsAutoGeneratedKeys = supportsAutoGeneratedKeys;
69: return this;
70: }
71:
72: }
|