Thu, 31 Aug 2017 15:18:52 +0800
merge
1 /*
2 * Copyright (c) 1997, 2012, 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 */
26 package com.sun.tools.internal.ws.processor.model.java;
28 import com.sun.tools.internal.ws.processor.model.jaxb.JAXBTypeAndAnnotation;
30 /**
31 *
32 * @author WS Development Team
33 */
34 public abstract class JavaType {
36 private String name;
37 private String realName;
38 private boolean present;
39 private boolean holder;
40 private boolean holderPresent;
41 private String initString;
42 private String holderName;
43 private JAXBTypeAndAnnotation type;
45 public JavaType() {}
47 public JavaType(JAXBTypeAndAnnotation type){
48 this.type = type;
49 init(type.getName(), false, null, null);
50 }
52 public JavaType(String name, boolean present, String initString) {
53 init(name, present, initString, null);
54 }
56 public JavaType(String name, boolean present, String initString,
57 String holderName) {
59 init(name, present, initString, holderName);
60 }
62 public JAXBTypeAndAnnotation getType(){
63 return type;
64 }
66 private void init(String name, boolean present, String initString,
67 String holderName) {
69 this.realName = name;
70 this.name = name.replace('$', '.');
71 this.present = present;
72 this.initString = initString;
73 this.holderName = holderName;
74 holder = holderName != null;
75 }
77 public String getName() {
78 return name;
79 }
81 public void doSetName(String name) {
83 // renamed to avoid creating a "name" property with broken semantics
84 this.realName = name;
85 this.name = name.replace('$', '.');
86 }
88 public String getRealName() {
89 return realName;
90 }
92 /* serialization */
93 public void setRealName(String s) {
94 realName = s;
95 }
97 public String getFormalName() {
98 return name;
99 }
101 public void setFormalName(String s) {
102 name = s;
103 }
105 public boolean isPresent() {
106 return present;
107 }
109 /* serialization */
110 public void setPresent(boolean b) {
111 present = b;
112 }
114 public boolean isHolder() {
115 return holder;
116 }
118 public void setHolder(boolean holder) {
119 this.holder = holder;
120 }
122 public boolean isHolderPresent() {
123 return holderPresent;
124 }
125 public void setHolderPresent(boolean holderPresent) {
126 this.holderPresent = holderPresent;
127 }
129 public String getInitString() {
130 return initString;
131 }
133 /* serialization */
134 public void setInitString(String s) {
135 initString = s;
136 }
138 public String getHolderName() {
139 return holderName;
140 }
142 public void setHolderName(String holderName) {
143 this.holderName = holderName;
144 }
145 }