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
157 properties.remove(keyName);
158 if(!type.isInstance(o))
159 throw new JAXBException(Messages.INVALID_PROPERTY_VALUE.format(keyName,o));
160 else
161 return type.cast(o);
162 }
163
164 /**
165 *
166 * @param classes
167 * @param typeRefs
168 * @param subclassReplacements
169 * @param defaultNsUri
170 * @param c14nSupport
171 * @param ar
172 * @param xmlAccessorFactorySupport
173 * @param allNillable
174 * @param retainPropertyInfo
175 * @return
176 * @throws JAXBException
177 * @deprecated use createContext(Class[] classes, Map<String,Object> properties) method instead
178 */
179 @Deprecated
180 public static JAXBRIContext createContext( Class[] classes,
181 Collection<TypeReference> typeRefs, Map<Class,Class> subclassReplacements,
182 String defaultNsUri, boolean c14nSupport, RuntimeAnnotationReader ar,
183 boolean xmlAccessorFactorySupport, boolean allNillable, boolean retainPropertyInfo) throws JAXBException {
184
185 return createContext(classes, typeRefs, subclassReplacements,
186 defaultNsUri, c14nSupport, ar, xmlAccessorFactorySupport,
187 allNillable, retainPropertyInfo, false);
188 }
189
190 /**
191 *
192 * @param classes
193 * @param typeRefs
194 * @param subclassReplacements
195 * @param defaultNsUri
196 * @param c14nSupport
197 * @param ar
198 * @param xmlAccessorFactorySupport
199 * @param allNillable
200 * @param retainPropertyInfo
201 * @param improvedXsiTypeHandling
202 * @return
203 * @throws JAXBException
204 * @deprecated use createContext( Class[] classes, Map<String,Object> properties) method instead
205 */
206 @Deprecated
207 public static JAXBRIContext createContext( Class[] classes,
208 Collection<TypeReference> typeRefs, Map<Class,Class> subclassReplacements,
209 String defaultNsUri, boolean c14nSupport, RuntimeAnnotationReader ar,
210 boolean xmlAccessorFactorySupport, boolean allNillable, boolean retainPropertyInfo, boolean improvedXsiTypeHandling) throws JAXBException {
211
212 JAXBContextImpl.JAXBContextBuilder builder = new JAXBContextImpl.JAXBContextBuilder();
213 builder.setClasses(classes);
214 builder.setTypeRefs(typeRefs);
215 builder.setSubclassReplacements(subclassReplacements);
216 builder.setDefaultNsUri(defaultNsUri);
217 builder.setC14NSupport(c14nSupport);
218 builder.setAnnotationReader(ar);
219 builder.setXmlAccessorFactorySupport(xmlAccessorFactorySupport);
220 builder.setAllNillable(allNillable);
221 builder.setRetainPropertyInfo(retainPropertyInfo);
222 builder.setImprovedXsiTypeHandling(improvedXsiTypeHandling);
223 return builder.build();
224 }
|
1 /*
2 * Copyright (c) 1997, 2015, 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
157 properties.remove(keyName);
158 if(!type.isInstance(o))
159 throw new JAXBException(Messages.INVALID_PROPERTY_VALUE.format(keyName,o));
160 else
161 return type.cast(o);
162 }
163
164 /**
165 *
166 * @param classes
167 * @param typeRefs
168 * @param subclassReplacements
169 * @param defaultNsUri
170 * @param c14nSupport
171 * @param ar
172 * @param xmlAccessorFactorySupport
173 * @param allNillable
174 * @param retainPropertyInfo
175 * @return
176 * @throws JAXBException
177 * @deprecated use {@code createContext(Class[] classes, Map<String,Object> properties)} method instead
178 */
179 @Deprecated
180 public static JAXBRIContext createContext( Class[] classes,
181 Collection<TypeReference> typeRefs, Map<Class,Class> subclassReplacements,
182 String defaultNsUri, boolean c14nSupport, RuntimeAnnotationReader ar,
183 boolean xmlAccessorFactorySupport, boolean allNillable, boolean retainPropertyInfo) throws JAXBException {
184
185 return createContext(classes, typeRefs, subclassReplacements,
186 defaultNsUri, c14nSupport, ar, xmlAccessorFactorySupport,
187 allNillable, retainPropertyInfo, false);
188 }
189
190 /**
191 *
192 * @param classes
193 * @param typeRefs
194 * @param subclassReplacements
195 * @param defaultNsUri
196 * @param c14nSupport
197 * @param ar
198 * @param xmlAccessorFactorySupport
199 * @param allNillable
200 * @param retainPropertyInfo
201 * @param improvedXsiTypeHandling
202 * @return
203 * @throws JAXBException
204 * @deprecated use {@code createContext( Class[] classes, Map<String,Object> properties)} method instead
205 */
206 @Deprecated
207 public static JAXBRIContext createContext( Class[] classes,
208 Collection<TypeReference> typeRefs, Map<Class,Class> subclassReplacements,
209 String defaultNsUri, boolean c14nSupport, RuntimeAnnotationReader ar,
210 boolean xmlAccessorFactorySupport, boolean allNillable, boolean retainPropertyInfo, boolean improvedXsiTypeHandling) throws JAXBException {
211
212 JAXBContextImpl.JAXBContextBuilder builder = new JAXBContextImpl.JAXBContextBuilder();
213 builder.setClasses(classes);
214 builder.setTypeRefs(typeRefs);
215 builder.setSubclassReplacements(subclassReplacements);
216 builder.setDefaultNsUri(defaultNsUri);
217 builder.setC14NSupport(c14nSupport);
218 builder.setAnnotationReader(ar);
219 builder.setXmlAccessorFactorySupport(xmlAccessorFactorySupport);
220 builder.setAllNillable(allNillable);
221 builder.setRetainPropertyInfo(retainPropertyInfo);
222 builder.setImprovedXsiTypeHandling(improvedXsiTypeHandling);
223 return builder.build();
224 }
|