01: /*
02: * This file is part of PFIXCORE.
03: *
04: * PFIXCORE is free software; you can redistribute it and/or modify
05: * it under the terms of the GNU Lesser General Public License as published by
06: * the Free Software Foundation; either version 2 of the License, or
07: * (at your option) any later version.
08: *
09: * PFIXCORE is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public License
15: * along with PFIXCORE; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: *
18: */
19:
20: package de.schlund.pfixcore.beans.metadata;
21:
22: import java.util.HashMap;
23: import java.util.Map;
24:
25: /**
26: * @author mleidig@schlund.de
27: */
28: public class Bean {
29:
30: String className;
31: Map<String, Property> properties;
32: boolean excludeByDefault;
33:
34: public Bean(String className) {
35: this .className = className;
36: properties = new HashMap<String, Property>();
37: }
38:
39: public String getClassName() {
40: return className;
41: }
42:
43: public Property getProperty(String name) {
44: return properties.get(name);
45: }
46:
47: public void setProperty(Property property) {
48: properties.put(property.getName(), property);
49: }
50:
51: public boolean isExcludedByDefault() {
52: return excludeByDefault;
53: }
54:
55: public void excludeByDefault() {
56: excludeByDefault = true;
57: }
58:
59: public void excludeProperty(String name) {
60: Property prop = getProperty(name);
61: if (prop == null) {
62: prop = new Property(name);
63: setProperty(prop);
64: }
65: prop.exclude();
66: }
67:
68: public void includeProperty(String name) {
69: Property prop = getProperty(name);
70: if (prop == null) {
71: prop = new Property(name);
72: setProperty(prop);
73: }
74: prop.include();
75: }
76:
77: public void setPropertyAlias(String name, String alias) {
78: Property prop = getProperty(name);
79: if (prop == null) {
80: prop = new Property(name);
81: setProperty(prop);
82: }
83: prop.setAlias(alias);
84: }
85:
86: }
|