001: /*
002: * Portions Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: package com.sun.tools.internal.ws.processor.model;
027:
028: import java.util.HashMap;
029: import java.util.Iterator;
030: import java.util.Map;
031:
032: import javax.xml.namespace.QName;
033:
034: import com.sun.tools.internal.ws.processor.model.java.JavaType;
035: import com.sun.xml.internal.ws.util.NullIterator;
036:
037: /**
038: *
039: * @author WS Development Team
040: */
041: public abstract class AbstractType {
042:
043: protected AbstractType() {
044: }
045:
046: protected AbstractType(QName name) {
047: this (name, null, null);
048: }
049:
050: protected AbstractType(QName name, String version) {
051: this (name, null, version);
052: }
053:
054: protected AbstractType(QName name, JavaType javaType) {
055: this (name, javaType, null);
056: }
057:
058: protected AbstractType(QName name, JavaType javaType, String version) {
059: this .name = name;
060: this .javaType = javaType;
061: this .version = version;
062: }
063:
064: public QName getName() {
065: return name;
066: }
067:
068: public void setName(QName name) {
069: this .name = name;
070: }
071:
072: public JavaType getJavaType() {
073: return javaType;
074: }
075:
076: public void setJavaType(JavaType javaType) {
077: this .javaType = javaType;
078: }
079:
080: public String getVersion() {
081: return version;
082: }
083:
084: public void setVersion(String version) {
085: this .version = version;
086: }
087:
088: public boolean isNillable() {
089: return false;
090: }
091:
092: public boolean isSOAPType() {
093: return false;
094: }
095:
096: public boolean isLiteralType() {
097: return false;
098: }
099:
100: public Object getProperty(String key) {
101: if (properties == null) {
102: return null;
103: }
104: return properties.get(key);
105: }
106:
107: public void setProperty(String key, Object value) {
108: if (value == null) {
109: removeProperty(key);
110: return;
111: }
112:
113: if (properties == null) {
114: properties = new HashMap();
115: }
116: properties.put(key, value);
117: }
118:
119: public void removeProperty(String key) {
120: if (properties != null) {
121: properties.remove(key);
122: }
123: }
124:
125: public Iterator getProperties() {
126: if (properties == null) {
127: return NullIterator.getInstance();
128: } else {
129: return properties.keySet().iterator();
130: }
131: }
132:
133: /* serialization */
134: public Map getPropertiesMap() {
135: return properties;
136: }
137:
138: /* serialization */
139: public void setPropertiesMap(Map m) {
140: properties = m;
141: }
142:
143: private QName name;
144: private JavaType javaType;
145: private String version = null;
146: private Map properties;
147: }
|