001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common Development
008: * and Distribution License("CDDL") (collectively, the "License"). You
009: * may not use this file except in compliance with the License. You can obtain
010: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
011: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
012: * language governing permissions and limitations under the License.
013: *
014: * When distributing the software, include this License Header Notice in each
015: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
016: * Sun designates this particular file as subject to the "Classpath" exception
017: * as provided by Sun in the GPL Version 2 section of the License file that
018: * accompanied this code. If applicable, add the following below the License
019: * Header, with the fields enclosed by brackets [] replaced by your own
020: * identifying information: "Portions Copyrighted [year]
021: * [name of copyright owner]"
022: *
023: * Contributor(s):
024: *
025: * If you wish your version of this file to be governed by only the CDDL or
026: * only the GPL Version 2, indicate your decision by adding "[Contributor]
027: * elects to include this software in this distribution under the [CDDL or GPL
028: * Version 2] license." If you don't indicate a single choice of license, a
029: * recipient has the option to distribute your version of this file under
030: * either the CDDL, the GPL Version 2 or to extend the choice of license to
031: * its licensees as provided above. However, if you add GPL Version 2 code
032: * and therefore, elected the GPL Version 2 license, then the option applies
033: * only if the new code is made subject to such option by the copyright
034: * holder.
035: */
036:
037: package com.sun.tools.ws.processor.model.java;
038:
039: import com.sun.tools.ws.processor.model.jaxb.JAXBTypeAndAnnotation;
040:
041: /**
042: *
043: * @author WS Development Team
044: */
045: public abstract class JavaType {
046:
047: private String name;
048: private String realName;
049: private boolean present;
050: private boolean holder;
051: private boolean holderPresent;
052: private String initString;
053: private String holderName;
054: private JAXBTypeAndAnnotation type;
055:
056: public JavaType() {
057: }
058:
059: public JavaType(JAXBTypeAndAnnotation type) {
060: this .type = type;
061: init(type.getName(), false, null, null);
062: }
063:
064: public JavaType(String name, boolean present, String initString) {
065: init(name, present, initString, null);
066: }
067:
068: public JavaType(String name, boolean present, String initString,
069: String holderName) {
070:
071: init(name, present, initString, holderName);
072: }
073:
074: public JAXBTypeAndAnnotation getType() {
075: return type;
076: }
077:
078: private void init(String name, boolean present, String initString,
079: String holderName) {
080:
081: this .realName = name;
082: this .name = name.replace('$', '.');
083: this .present = present;
084: this .initString = initString;
085: this .holderName = holderName;
086: holder = holderName != null;
087: }
088:
089: public String getName() {
090: return name;
091: }
092:
093: public void doSetName(String name) {
094:
095: // renamed to avoid creating a "name" property with broken semantics
096: this .realName = name;
097: this .name = name.replace('$', '.');
098: }
099:
100: public String getRealName() {
101: return realName;
102: }
103:
104: /* serialization */
105: public void setRealName(String s) {
106: realName = s;
107: }
108:
109: public String getFormalName() {
110: return name;
111: }
112:
113: public void setFormalName(String s) {
114: name = s;
115: }
116:
117: public boolean isPresent() {
118: return present;
119: }
120:
121: /* serialization */
122: public void setPresent(boolean b) {
123: present = b;
124: }
125:
126: public boolean isHolder() {
127: return holder;
128: }
129:
130: public void setHolder(boolean holder) {
131: this .holder = holder;
132: }
133:
134: public boolean isHolderPresent() {
135: return holderPresent;
136: }
137:
138: public void setHolderPresent(boolean holderPresent) {
139: this .holderPresent = holderPresent;
140: }
141:
142: public String getInitString() {
143: return initString;
144: }
145:
146: /* serialization */
147: public void setInitString(String s) {
148: initString = s;
149: }
150:
151: public String getHolderName() {
152: return holderName;
153: }
154:
155: public void setHolderName(String holderName) {
156: this.holderName = holderName;
157: }
158: }
|