author | aefimov |
Fri, 10 Apr 2015 14:54:20 +0300 | |
changeset 29839 | 6d5d546e953b |
parent 25871 | b80b84e87032 |
permissions | -rw-r--r-- |
12009 | 1 |
/* |
29839
6d5d546e953b
8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412)
aefimov
parents:
25871
diff
changeset
|
2 |
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. |
12009 | 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 |
/* |
|
27 |
* Use is subject to the license terms. |
|
28 |
*/ |
|
29 |
package com.sun.tools.internal.xjc.outline; |
|
30 |
||
31 |
import java.util.List; |
|
32 |
||
33 |
import com.sun.codemodel.internal.JClass; |
|
34 |
import com.sun.codemodel.internal.JDefinedClass; |
|
35 |
import com.sun.tools.internal.xjc.model.CClassInfo; |
|
29839
6d5d546e953b
8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412)
aefimov
parents:
25871
diff
changeset
|
36 |
import com.sun.tools.internal.xjc.model.CCustomizable; |
12009 | 37 |
import com.sun.tools.internal.xjc.model.CPropertyInfo; |
38 |
import com.sun.istack.internal.NotNull; |
|
39 |
||
40 |
/** |
|
41 |
* Outline object that provides per-{@link CClassInfo} information |
|
42 |
* for filling in methods/fields for a bean. |
|
43 |
* |
|
44 |
* This interface is accessible from {@link Outline} |
|
45 |
* |
|
46 |
* @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) |
|
47 |
*/ |
|
29839
6d5d546e953b
8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412)
aefimov
parents:
25871
diff
changeset
|
48 |
public abstract class ClassOutline implements CustomizableOutline { |
12009 | 49 |
|
50 |
/** |
|
51 |
* A {@link Outline} that encloses all the class outlines. |
|
52 |
*/ |
|
53 |
public abstract @NotNull Outline parent(); |
|
54 |
||
55 |
/** |
|
56 |
* {@link PackageOutline} that contains this class. |
|
57 |
*/ |
|
58 |
public @NotNull PackageOutline _package() { |
|
59 |
return parent().getPackageContext(ref._package()); |
|
60 |
} |
|
61 |
||
62 |
/** |
|
63 |
* This {@link ClassOutline} holds information about this {@link CClassInfo}. |
|
64 |
*/ |
|
65 |
public final @NotNull CClassInfo target; |
|
66 |
||
67 |
/** |
|
68 |
* The exposed aspect of the a bean. |
|
69 |
* |
|
70 |
* implClass is always assignable to this type. |
|
71 |
* <p> |
|
72 |
* Usually this is the public content interface, but |
|
73 |
* it could be the same as the implClass. |
|
74 |
*/ |
|
75 |
public final @NotNull JDefinedClass ref; |
|
76 |
||
77 |
/** |
|
78 |
* The implementation aspect of a bean. |
|
79 |
* The actual place where fields/methods should be generated into. |
|
80 |
*/ |
|
81 |
public final @NotNull JDefinedClass implClass; |
|
82 |
||
83 |
/** |
|
84 |
* The implementation class that shall be used for reference. |
|
85 |
* <p> |
|
86 |
* Usually this field holds the same value as the {@link #implClass} method, |
|
87 |
* but sometimes it holds the user-specified implementation class |
|
88 |
* when it is specified. |
|
89 |
* <p> |
|
90 |
* This is the type that needs to be used for generating fields. |
|
91 |
*/ |
|
92 |
public final @NotNull JClass implRef; |
|
93 |
||
94 |
||
95 |
||
96 |
||
97 |
protected ClassOutline( CClassInfo _target, JDefinedClass exposedClass, JClass implRef, JDefinedClass _implClass) { |
|
98 |
this.target = _target; |
|
99 |
this.ref = exposedClass; |
|
100 |
this.implRef = implRef; |
|
101 |
this.implClass = _implClass; |
|
102 |
} |
|
103 |
||
104 |
/** |
|
105 |
* Gets all the {@link FieldOutline}s newly declared |
|
106 |
* in this class. |
|
107 |
*/ |
|
108 |
public final FieldOutline[] getDeclaredFields() { |
|
109 |
List<CPropertyInfo> props = target.getProperties(); |
|
110 |
FieldOutline[] fr = new FieldOutline[props.size()]; |
|
111 |
for( int i=0; i<fr.length; i++ ) |
|
112 |
fr[i] = parent().getField(props.get(i)); |
|
113 |
return fr; |
|
114 |
} |
|
115 |
||
116 |
/** |
|
117 |
* Returns the super class of this class, if it has the |
|
118 |
* super class and it is also a JAXB-bound class. |
|
119 |
* Otherwise null. |
|
120 |
*/ |
|
121 |
public final ClassOutline getSuperClass() { |
|
122 |
CClassInfo s = target.getBaseClass(); |
|
123 |
if(s==null) return null; |
|
124 |
return parent().getClazz(s); |
|
125 |
} |
|
29839
6d5d546e953b
8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412)
aefimov
parents:
25871
diff
changeset
|
126 |
|
6d5d546e953b
8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412)
aefimov
parents:
25871
diff
changeset
|
127 |
@Override |
6d5d546e953b
8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412)
aefimov
parents:
25871
diff
changeset
|
128 |
public JDefinedClass getImplClass() { |
6d5d546e953b
8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412)
aefimov
parents:
25871
diff
changeset
|
129 |
return implClass; |
6d5d546e953b
8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412)
aefimov
parents:
25871
diff
changeset
|
130 |
} |
6d5d546e953b
8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412)
aefimov
parents:
25871
diff
changeset
|
131 |
|
6d5d546e953b
8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412)
aefimov
parents:
25871
diff
changeset
|
132 |
@Override |
6d5d546e953b
8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412)
aefimov
parents:
25871
diff
changeset
|
133 |
public CCustomizable getTarget() { |
6d5d546e953b
8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412)
aefimov
parents:
25871
diff
changeset
|
134 |
return target; |
6d5d546e953b
8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412)
aefimov
parents:
25871
diff
changeset
|
135 |
} |
12009 | 136 |
} |