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
25
26 package com.sun.xml.internal.bind.v2.model.impl;
27
28 import java.lang.reflect.Field;
29 import java.lang.reflect.Method;
30 import java.lang.reflect.Type;
31 import java.util.Collection;
32 import java.util.Collections;
33 import java.util.List;
34
35 import javax.xml.bind.JAXBElement;
36 import javax.xml.bind.annotation.adapters.XmlAdapter;
37
38 import com.sun.xml.internal.bind.v2.model.core.Adapter;
39 import com.sun.xml.internal.bind.v2.model.runtime.RuntimeClassInfo;
40 import com.sun.xml.internal.bind.v2.model.runtime.RuntimeElementInfo;
41 import com.sun.xml.internal.bind.v2.model.runtime.RuntimeElementPropertyInfo;
42 import com.sun.xml.internal.bind.v2.model.runtime.RuntimeNonElement;
43 import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo;
44 import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeRef;
45 import com.sun.xml.internal.bind.v2.model.nav.Navigator;
46 import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException;
47 import com.sun.xml.internal.bind.v2.runtime.Transducer;
48 import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor;
49
50 /**
51 * @author Kohsuke Kawaguchi
52 */
53 final class RuntimeElementInfoImpl extends ElementInfoImpl<Type,Class,Field,Method>
54 implements RuntimeElementInfo {
55
56 public RuntimeElementInfoImpl(RuntimeModelBuilder modelBuilder, RegistryInfoImpl registry, Method method) throws IllegalAnnotationException {
57 super(modelBuilder, registry, method);
58
59 Adapter<Type,Class> a = getProperty().getAdapter();
60
61 if(a!=null)
62 adapterType = a.adapterType;
63 else
64 adapterType = null;
65 }
105
106 public RuntimePropertyInfo getSource() {
107 return this;
108 }
109
110 public Transducer getTransducer() {
111 return RuntimeModelBuilder.createTransducer(this);
112 }
113 }
114
115 /**
116 * The adapter specified by <code>getProperty().getAdapter()</code>.
117 */
118 private final Class<? extends XmlAdapter> adapterType;
119
120 public RuntimeElementPropertyInfo getProperty() {
121 return (RuntimeElementPropertyInfo)super.getProperty();
122 }
123
124 public Class<? extends JAXBElement> getType() {
125 return Navigator.REFLECTION.erasure(super.getType());
126 }
127
128 public RuntimeClassInfo getScope() {
129 return (RuntimeClassInfo)super.getScope();
130 }
131
132 public RuntimeNonElement getContentType() {
133 return (RuntimeNonElement)super.getContentType();
134 }
135 }
|
1 /*
2 * Copyright (c) 1997, 2014, 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
25
26 package com.sun.xml.internal.bind.v2.model.impl;
27
28 import java.lang.reflect.Field;
29 import java.lang.reflect.Method;
30 import java.lang.reflect.Type;
31 import java.util.Collection;
32 import java.util.Collections;
33 import java.util.List;
34
35 import javax.xml.bind.JAXBElement;
36 import javax.xml.bind.annotation.adapters.XmlAdapter;
37
38 import com.sun.xml.internal.bind.v2.model.core.Adapter;
39 import com.sun.xml.internal.bind.v2.model.runtime.RuntimeClassInfo;
40 import com.sun.xml.internal.bind.v2.model.runtime.RuntimeElementInfo;
41 import com.sun.xml.internal.bind.v2.model.runtime.RuntimeElementPropertyInfo;
42 import com.sun.xml.internal.bind.v2.model.runtime.RuntimeNonElement;
43 import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo;
44 import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeRef;
45 import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException;
46 import com.sun.xml.internal.bind.v2.runtime.Transducer;
47 import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor;
48
49 /**
50 * @author Kohsuke Kawaguchi
51 */
52 final class RuntimeElementInfoImpl extends ElementInfoImpl<Type,Class,Field,Method>
53 implements RuntimeElementInfo {
54
55 public RuntimeElementInfoImpl(RuntimeModelBuilder modelBuilder, RegistryInfoImpl registry, Method method) throws IllegalAnnotationException {
56 super(modelBuilder, registry, method);
57
58 Adapter<Type,Class> a = getProperty().getAdapter();
59
60 if(a!=null)
61 adapterType = a.adapterType;
62 else
63 adapterType = null;
64 }
104
105 public RuntimePropertyInfo getSource() {
106 return this;
107 }
108
109 public Transducer getTransducer() {
110 return RuntimeModelBuilder.createTransducer(this);
111 }
112 }
113
114 /**
115 * The adapter specified by <code>getProperty().getAdapter()</code>.
116 */
117 private final Class<? extends XmlAdapter> adapterType;
118
119 public RuntimeElementPropertyInfo getProperty() {
120 return (RuntimeElementPropertyInfo)super.getProperty();
121 }
122
123 public Class<? extends JAXBElement> getType() {
124 //noinspection unchecked
125 return (Class<? extends JAXBElement>) Utils.REFLECTION_NAVIGATOR.erasure(super.getType());
126 }
127
128 public RuntimeClassInfo getScope() {
129 return (RuntimeClassInfo)super.getScope();
130 }
131
132 public RuntimeNonElement getContentType() {
133 return (RuntimeNonElement)super.getContentType();
134 }
135 }
|