01: /*
02: * Portions Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
03: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04: *
05: * This code is free software; you can redistribute it and/or modify it
06: * under the terms of the GNU General Public License version 2 only, as
07: * published by the Free Software Foundation. Sun designates this
08: * particular file as subject to the "Classpath" exception as provided
09: * by Sun in the LICENSE file that accompanied this code.
10: *
11: * This code is distributed in the hope that it will be useful, but WITHOUT
12: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14: * version 2 for more details (a copy is included in the LICENSE file that
15: * accompanied this code).
16: *
17: * You should have received a copy of the GNU General Public License version
18: * 2 along with this work; if not, write to the Free Software Foundation,
19: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20: *
21: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22: * CA 95054 USA or visit www.sun.com if you need additional information or
23: * have any questions.
24: */
25:
26: package com.sun.tools.internal.ws.processor.model;
27:
28: import java.util.HashMap;
29: import java.util.Iterator;
30: import java.util.Map;
31:
32: import com.sun.xml.internal.ws.util.NullIterator;
33:
34: /**
35: *
36: * @author WS Development Team
37: */
38: public abstract class ModelObject {
39:
40: public abstract void accept(ModelVisitor visitor) throws Exception;
41:
42: public Object getProperty(String key) {
43: if (_properties == null) {
44: return null;
45: }
46: return _properties.get(key);
47: }
48:
49: public void setProperty(String key, Object value) {
50: if (value == null) {
51: removeProperty(key);
52: return;
53: }
54:
55: if (_properties == null) {
56: _properties = new HashMap();
57: }
58: _properties.put(key, value);
59: }
60:
61: public void removeProperty(String key) {
62: if (_properties != null) {
63: _properties.remove(key);
64: }
65: }
66:
67: public Iterator getProperties() {
68: if (_properties == null) {
69: return NullIterator.getInstance();
70: } else {
71: return _properties.keySet().iterator();
72: }
73: }
74:
75: /* serialization */
76: public Map getPropertiesMap() {
77: return _properties;
78: }
79:
80: /* serialization */
81: public void setPropertiesMap(Map m) {
82: _properties = m;
83: }
84:
85: public String getJavaDoc() {
86: return javaDoc;
87: }
88:
89: public void setJavaDoc(String javaDoc) {
90: this .javaDoc = javaDoc;
91: }
92:
93: private String javaDoc;
94: private Map _properties;
95: }
|