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.java;
027:
028: import com.sun.codemodel.internal.JType;
029: import com.sun.tools.internal.xjc.api.TypeAndAnnotation;
030: import com.sun.tools.internal.ws.processor.model.jaxb.JAXBTypeAndAnnotation;
031:
032: /**
033: *
034: * @author WS Development Team
035: */
036: public abstract class JavaType {
037:
038: private String name;
039: private String realName;
040: private boolean present;
041: private boolean holder;
042: private boolean holderPresent;
043: private String initString;
044: private String holderName;
045: private JAXBTypeAndAnnotation type;
046:
047: public JavaType() {
048: }
049:
050: public JavaType(JAXBTypeAndAnnotation type) {
051: this .type = type;
052: init(type.getName(), false, null, null);
053: }
054:
055: public JavaType(String name, boolean present, String initString) {
056: init(name, present, initString, null);
057: }
058:
059: public JavaType(String name, boolean present, String initString,
060: String holderName) {
061:
062: init(name, present, initString, holderName);
063: }
064:
065: public JAXBTypeAndAnnotation getType() {
066: return type;
067: }
068:
069: private void init(String name, boolean present, String initString,
070: String holderName) {
071:
072: this .realName = name;
073: this .name = name.replace('$', '.');
074: this .present = present;
075: this .initString = initString;
076: this .holderName = holderName;
077: holder = holderName != null;
078: }
079:
080: public String getName() {
081: return name;
082: }
083:
084: public void doSetName(String name) {
085:
086: // renamed to avoid creating a "name" property with broken semantics
087: this .realName = name;
088: this .name = name.replace('$', '.');
089: }
090:
091: public String getRealName() {
092: return realName;
093: }
094:
095: /* serialization */
096: public void setRealName(String s) {
097: realName = s;
098: }
099:
100: public String getFormalName() {
101: return name;
102: }
103:
104: public void setFormalName(String s) {
105: name = s;
106: }
107:
108: public boolean isPresent() {
109: return present;
110: }
111:
112: /* serialization */
113: public void setPresent(boolean b) {
114: present = b;
115: }
116:
117: public boolean isHolder() {
118: return holder;
119: }
120:
121: public void setHolder(boolean holder) {
122: this .holder = holder;
123: }
124:
125: public boolean isHolderPresent() {
126: return holderPresent;
127: }
128:
129: public void setHolderPresent(boolean holderPresent) {
130: this .holderPresent = holderPresent;
131: }
132:
133: public String getInitString() {
134: return initString;
135: }
136:
137: /* serialization */
138: public void setInitString(String s) {
139: initString = s;
140: }
141:
142: public String getHolderName() {
143: return holderName;
144: }
145:
146: public void setHolderName(String holderName) {
147: this.holderName = holderName;
148: }
149: }
|