1 /* 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package com.sun.tools.internal.ws.processor.model; 27 28 import com.sun.tools.internal.ws.processor.model.java.JavaType; 29 30 import javax.xml.namespace.QName; 31 import java.util.Collections; 32 import java.util.HashMap; 33 import java.util.Iterator; 34 import java.util.Map; 35 36 /** 37 * 38 * @author WS Development Team 39 */ 40 public abstract class AbstractType { 41 42 protected AbstractType() {} 43 44 protected AbstractType(QName name) { 45 this(name, null, null); 46 } 47 48 protected AbstractType(QName name, String version) { 49 this(name, null, version); 50 } 51 52 protected AbstractType(QName name, JavaType javaType) { 53 this(name, javaType, null); 54 } 55 56 protected AbstractType(QName name, JavaType javaType, String version) { 57 this.name = name; 58 this.javaType = javaType; 59 this.version = version; 60 } 61 62 public QName getName() { 63 return name; 64 } 65 66 public void setName(QName name) { 67 this.name = name; 68 } 69 70 public JavaType getJavaType() { 71 return javaType; 72 } 73 74 public void setJavaType(JavaType javaType) { 75 this.javaType = javaType; 76 } 77 78 public String getVersion() { 79 return version; 80 } 81 82 public void setVersion(String version) { 83 this.version = version; 84 } 85 86 public boolean isNillable() { 87 return false; 88 } 89 90 public boolean isSOAPType() { 91 return false; 92 } 93 94 public boolean isLiteralType() { 95 return false; 96 } 97 98 public Object getProperty(String key) { 99 if (properties == null) { 100 return null; 101 } 102 return properties.get(key); 103 } 104 105 public void setProperty(String key, Object value) { 106 if (value == null) { 107 removeProperty(key); 108 return; 109 } 110 111 if (properties == null) { 112 properties = new HashMap(); 113 } 114 properties.put(key, value); 115 } 116 117 public void removeProperty(String key) { 118 if (properties != null) { 119 properties.remove(key); 120 } 121 } 122 123 public Iterator getProperties() { 124 if (properties == null) { 125 return Collections.emptyList().iterator(); 126 } else { 127 return properties.keySet().iterator(); 128 } 129 } 130 131 /* serialization */ 132 public Map getPropertiesMap() { 133 return properties; 134 } 135 136 /* serialization */ 137 public void setPropertiesMap(Map m) { 138 properties = m; 139 } 140 141 private QName name; 142 private JavaType javaType; 143 private String version = null; 144 private Map properties; 145 }