Thu, 31 Aug 2017 15:18:52 +0800
merge
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. Oracle designates this |
aoqi@0 | 8 | * particular file as subject to the "Classpath" exception as provided |
aoqi@0 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
aoqi@0 | 10 | * |
aoqi@0 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 15 | * accompanied this code). |
aoqi@0 | 16 | * |
aoqi@0 | 17 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 20 | * |
aoqi@0 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 22 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 23 | * questions. |
aoqi@0 | 24 | */ |
aoqi@0 | 25 | |
aoqi@0 | 26 | package javax.xml.bind; |
aoqi@0 | 27 | |
aoqi@0 | 28 | import org.w3c.dom.Node; |
aoqi@0 | 29 | |
aoqi@0 | 30 | import javax.xml.validation.Schema; |
aoqi@0 | 31 | |
aoqi@0 | 32 | /** |
aoqi@0 | 33 | * Enable synchronization between XML infoset nodes and JAXB objects |
aoqi@0 | 34 | * representing same XML document. |
aoqi@0 | 35 | * |
aoqi@0 | 36 | * <p> |
aoqi@0 | 37 | * An instance of this class maintains the association between XML nodes of |
aoqi@0 | 38 | * an infoset preserving view and a JAXB representation of an XML document. |
aoqi@0 | 39 | * Navigation between the two views is provided by the methods |
aoqi@0 | 40 | * {@link #getXMLNode(Object)} and {@link #getJAXBNode(Object)}. |
aoqi@0 | 41 | * |
aoqi@0 | 42 | * <p> |
aoqi@0 | 43 | * Modifications can be made to either the infoset preserving view or the |
aoqi@0 | 44 | * JAXB representation of the document while the other view remains |
aoqi@0 | 45 | * unmodified. The binder is able to synchronize the changes made in the |
aoqi@0 | 46 | * modified view back into the other view using the appropriate |
aoqi@0 | 47 | * Binder update methods, {@link #updateXML(Object, Object)} or |
aoqi@0 | 48 | * {@link #updateJAXB(Object)}. |
aoqi@0 | 49 | * |
aoqi@0 | 50 | * <p> |
aoqi@0 | 51 | * A typical usage scenario is the following: |
aoqi@0 | 52 | * <ul> |
aoqi@0 | 53 | * <li>load XML document into an XML infoset representation</li> |
aoqi@0 | 54 | * <li>{@link #unmarshal(Object)} XML infoset view to JAXB view. |
aoqi@0 | 55 | * (Note to conserve resources, it is possible to only unmarshal a |
aoqi@0 | 56 | * subtree of the XML infoset view to the JAXB view.)</li> |
aoqi@0 | 57 | * <li>application access/updates JAXB view of XML document.</li> |
aoqi@0 | 58 | * <li>{@link #updateXML(Object)} synchronizes modifications to JAXB view |
aoqi@0 | 59 | * back into the XML infoset view. Update operation preserves as |
aoqi@0 | 60 | * much of original XML infoset as possible (i.e. comments, PI, ...)</li> |
aoqi@0 | 61 | * </ul> |
aoqi@0 | 62 | * |
aoqi@0 | 63 | * <p> |
aoqi@0 | 64 | * A Binder instance is created using the factory method |
aoqi@0 | 65 | * {@link JAXBContext#createBinder()} or {@link JAXBContext#createBinder(Class)}. |
aoqi@0 | 66 | * |
aoqi@0 | 67 | * <p> |
aoqi@0 | 68 | * The template parameter, <code>XmlNode</code>, is the |
aoqi@0 | 69 | * root interface/class for the XML infoset preserving representation. |
aoqi@0 | 70 | * A Binder implementation is required to minimally support |
aoqi@0 | 71 | * an <code>XmlNode</code> value of <code>org.w3c.dom.Node.class</code>. |
aoqi@0 | 72 | * A Binder implementation can support alternative XML infoset |
aoqi@0 | 73 | * preserving representations. |
aoqi@0 | 74 | * |
aoqi@0 | 75 | * @author |
aoqi@0 | 76 | * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) |
aoqi@0 | 77 | * Joseph Fialli |
aoqi@0 | 78 | * |
aoqi@0 | 79 | * @since JAXB 2.0 |
aoqi@0 | 80 | */ |
aoqi@0 | 81 | public abstract class Binder<XmlNode> { |
aoqi@0 | 82 | /** |
aoqi@0 | 83 | * Unmarshal XML infoset view to a JAXB object tree. |
aoqi@0 | 84 | * |
aoqi@0 | 85 | * <p> |
aoqi@0 | 86 | * This method is similar to {@link Unmarshaller#unmarshal(Node)} |
aoqi@0 | 87 | * with the addition of maintaining the association between XML nodes |
aoqi@0 | 88 | * and the produced JAXB objects, enabling future update operations, |
aoqi@0 | 89 | * {@link #updateXML(Object, Object)} or {@link #updateJAXB(Object)}. |
aoqi@0 | 90 | * |
aoqi@0 | 91 | * <p> |
aoqi@0 | 92 | * When {@link #getSchema()} is non-null, <code>xmlNode</code> |
aoqi@0 | 93 | * and its descendants is validated during this operation. |
aoqi@0 | 94 | * |
aoqi@0 | 95 | * <p> |
aoqi@0 | 96 | * This method throws {@link UnmarshalException} when the Binder's |
aoqi@0 | 97 | * {@link JAXBContext} does not have a mapping for the XML element name |
aoqi@0 | 98 | * or the type, specifiable via <tt>@xsi:type</tt>, of <tt>xmlNode</tt> |
aoqi@0 | 99 | * to a JAXB mapped class. The method {@link #unmarshal(Object, Class)} |
aoqi@0 | 100 | * enables an application to specify the JAXB mapped class that |
aoqi@0 | 101 | * the <tt>xmlNode</tt> should be mapped to. |
aoqi@0 | 102 | * |
aoqi@0 | 103 | * @param xmlNode |
aoqi@0 | 104 | * the document/element to unmarshal XML data from. |
aoqi@0 | 105 | * |
aoqi@0 | 106 | * @return |
aoqi@0 | 107 | * the newly created root object of the JAXB object tree. |
aoqi@0 | 108 | * |
aoqi@0 | 109 | * @throws JAXBException |
aoqi@0 | 110 | * If any unexpected errors occur while unmarshalling |
aoqi@0 | 111 | * @throws UnmarshalException |
aoqi@0 | 112 | * If the {@link ValidationEventHandler ValidationEventHandler} |
aoqi@0 | 113 | * returns false from its <tt>handleEvent</tt> method or the |
aoqi@0 | 114 | * <tt>Binder</tt> is unable to perform the XML to Java |
aoqi@0 | 115 | * binding. |
aoqi@0 | 116 | * @throws IllegalArgumentException |
aoqi@0 | 117 | * If the node parameter is null |
aoqi@0 | 118 | */ |
aoqi@0 | 119 | public abstract Object unmarshal( XmlNode xmlNode ) throws JAXBException; |
aoqi@0 | 120 | |
aoqi@0 | 121 | /** |
aoqi@0 | 122 | * Unmarshal XML root element by provided <tt>declaredType</tt> |
aoqi@0 | 123 | * to a JAXB object tree. |
aoqi@0 | 124 | * |
aoqi@0 | 125 | * <p> |
aoqi@0 | 126 | * Implements <a href="Unmarshaller.html#unmarshalByDeclaredType">Unmarshal by Declared Type</a> |
aoqi@0 | 127 | * |
aoqi@0 | 128 | * <p> |
aoqi@0 | 129 | * This method is similar to {@link Unmarshaller#unmarshal(Node, Class)} |
aoqi@0 | 130 | * with the addition of maintaining the association between XML nodes |
aoqi@0 | 131 | * and the produced JAXB objects, enabling future update operations, |
aoqi@0 | 132 | * {@link #updateXML(Object, Object)} or {@link #updateJAXB(Object)}. |
aoqi@0 | 133 | * |
aoqi@0 | 134 | * <p> |
aoqi@0 | 135 | * When {@link #getSchema()} is non-null, <code>xmlNode</code> |
aoqi@0 | 136 | * and its descendants is validated during this operation. |
aoqi@0 | 137 | * |
aoqi@0 | 138 | * @param xmlNode |
aoqi@0 | 139 | * the document/element to unmarshal XML data from. |
aoqi@0 | 140 | * @param declaredType |
aoqi@0 | 141 | * appropriate JAXB mapped class to hold <tt>node</tt>'s XML data. |
aoqi@0 | 142 | * |
aoqi@0 | 143 | * @return |
aoqi@0 | 144 | * <a href="JAXBElement.html">JAXB Element</a> representation |
aoqi@0 | 145 | * of <tt>node</tt> |
aoqi@0 | 146 | * |
aoqi@0 | 147 | * @throws JAXBException |
aoqi@0 | 148 | * If any unexpected errors occur while unmarshalling |
aoqi@0 | 149 | * @throws UnmarshalException |
aoqi@0 | 150 | * If the {@link ValidationEventHandler ValidationEventHandler} |
aoqi@0 | 151 | * returns false from its <tt>handleEvent</tt> method or the |
aoqi@0 | 152 | * <tt>Binder</tt> is unable to perform the XML to Java |
aoqi@0 | 153 | * binding. |
aoqi@0 | 154 | * @throws IllegalArgumentException |
aoqi@0 | 155 | * If any of the input parameters are null |
aoqi@0 | 156 | * @since JAXB2.0 |
aoqi@0 | 157 | */ |
aoqi@0 | 158 | public abstract <T> JAXBElement<T> |
aoqi@0 | 159 | unmarshal( XmlNode xmlNode, Class<T> declaredType ) |
aoqi@0 | 160 | throws JAXBException; |
aoqi@0 | 161 | |
aoqi@0 | 162 | /** |
aoqi@0 | 163 | * Marshal a JAXB object tree to a new XML document. |
aoqi@0 | 164 | * |
aoqi@0 | 165 | * <p> |
aoqi@0 | 166 | * This method is similar to {@link Marshaller#marshal(Object, Node)} |
aoqi@0 | 167 | * with the addition of maintaining the association between JAXB objects |
aoqi@0 | 168 | * and the produced XML nodes, |
aoqi@0 | 169 | * enabling future update operations such as |
aoqi@0 | 170 | * {@link #updateXML(Object, Object)} or {@link #updateJAXB(Object)}. |
aoqi@0 | 171 | * |
aoqi@0 | 172 | * <p> |
aoqi@0 | 173 | * When {@link #getSchema()} is non-null, the marshalled |
aoqi@0 | 174 | * xml content is validated during this operation. |
aoqi@0 | 175 | * |
aoqi@0 | 176 | * @param jaxbObject |
aoqi@0 | 177 | * The content tree to be marshalled. |
aoqi@0 | 178 | * @param xmlNode |
aoqi@0 | 179 | * The parameter must be a Node that accepts children. |
aoqi@0 | 180 | * |
aoqi@0 | 181 | * @throws JAXBException |
aoqi@0 | 182 | * If any unexpected problem occurs during the marshalling. |
aoqi@0 | 183 | * @throws MarshalException |
aoqi@0 | 184 | * If the {@link ValidationEventHandler ValidationEventHandler} |
aoqi@0 | 185 | * returns false from its <tt>handleEvent</tt> method or the |
aoqi@0 | 186 | * <tt>Binder</tt> is unable to marshal <tt>jaxbObject</tt> (or any |
aoqi@0 | 187 | * object reachable from <tt>jaxbObject</tt>). |
aoqi@0 | 188 | * |
aoqi@0 | 189 | * @throws IllegalArgumentException |
aoqi@0 | 190 | * If any of the method parameters are null |
aoqi@0 | 191 | */ |
aoqi@0 | 192 | public abstract void marshal( Object jaxbObject, XmlNode xmlNode ) throws JAXBException; |
aoqi@0 | 193 | |
aoqi@0 | 194 | /** |
aoqi@0 | 195 | * Gets the XML element associated with the given JAXB object. |
aoqi@0 | 196 | * |
aoqi@0 | 197 | * <p> |
aoqi@0 | 198 | * Once a JAXB object tree is associated with an XML fragment, |
aoqi@0 | 199 | * this method enables navigation between the two trees. |
aoqi@0 | 200 | * |
aoqi@0 | 201 | * <p> |
aoqi@0 | 202 | * An association between an XML element and a JAXB object is |
aoqi@0 | 203 | * established by the bind methods and the update methods. |
aoqi@0 | 204 | * Note that this association is partial; not all XML elements |
aoqi@0 | 205 | * have associated JAXB objects, and not all JAXB objects have |
aoqi@0 | 206 | * associated XML elements. |
aoqi@0 | 207 | * |
aoqi@0 | 208 | * @param jaxbObject An instance that is reachable from a prior |
aoqi@0 | 209 | * call to a bind or update method that returned |
aoqi@0 | 210 | * a JAXB object tree. |
aoqi@0 | 211 | * |
aoqi@0 | 212 | * @return |
aoqi@0 | 213 | * null if the specified JAXB object is not known to this |
aoqi@0 | 214 | * {@link Binder}, or if it is not associated with an |
aoqi@0 | 215 | * XML element. |
aoqi@0 | 216 | * |
aoqi@0 | 217 | * @throws IllegalArgumentException |
aoqi@0 | 218 | * If the jaxbObject parameter is null |
aoqi@0 | 219 | */ |
aoqi@0 | 220 | public abstract XmlNode getXMLNode( Object jaxbObject ); |
aoqi@0 | 221 | |
aoqi@0 | 222 | /** |
aoqi@0 | 223 | * Gets the JAXB object associated with the given XML element. |
aoqi@0 | 224 | * |
aoqi@0 | 225 | * <p> |
aoqi@0 | 226 | * Once a JAXB object tree is associated with an XML fragment, |
aoqi@0 | 227 | * this method enables navigation between the two trees. |
aoqi@0 | 228 | * |
aoqi@0 | 229 | * <p> |
aoqi@0 | 230 | * An association between an XML element and a JAXB object is |
aoqi@0 | 231 | * established by the unmarshal, marshal and update methods. |
aoqi@0 | 232 | * Note that this association is partial; not all XML elements |
aoqi@0 | 233 | * have associated JAXB objects, and not all JAXB objects have |
aoqi@0 | 234 | * associated XML elements. |
aoqi@0 | 235 | * |
aoqi@0 | 236 | * @return |
aoqi@0 | 237 | * null if the specified XML node is not known to this |
aoqi@0 | 238 | * {@link Binder}, or if it is not associated with a |
aoqi@0 | 239 | * JAXB object. |
aoqi@0 | 240 | * |
aoqi@0 | 241 | * @throws IllegalArgumentException |
aoqi@0 | 242 | * If the node parameter is null |
aoqi@0 | 243 | */ |
aoqi@0 | 244 | public abstract Object getJAXBNode( XmlNode xmlNode ); |
aoqi@0 | 245 | |
aoqi@0 | 246 | /** |
aoqi@0 | 247 | * Takes an JAXB object and updates |
aoqi@0 | 248 | * its associated XML node and its descendants. |
aoqi@0 | 249 | * |
aoqi@0 | 250 | * <p> |
aoqi@0 | 251 | * This is a convenience method of: |
aoqi@0 | 252 | * <pre> |
aoqi@0 | 253 | * updateXML( jaxbObject, getXMLNode(jaxbObject)); |
aoqi@0 | 254 | * </pre> |
aoqi@0 | 255 | * |
aoqi@0 | 256 | * @throws JAXBException |
aoqi@0 | 257 | * If any unexpected problem occurs updating corresponding XML content. |
aoqi@0 | 258 | * @throws IllegalArgumentException |
aoqi@0 | 259 | * If the jaxbObject parameter is null |
aoqi@0 | 260 | */ |
aoqi@0 | 261 | public abstract XmlNode updateXML( Object jaxbObject ) throws JAXBException; |
aoqi@0 | 262 | |
aoqi@0 | 263 | /** |
aoqi@0 | 264 | * Changes in JAXB object tree are updated in its associated XML parse tree. |
aoqi@0 | 265 | * |
aoqi@0 | 266 | * <p> |
aoqi@0 | 267 | * This operation can be thought of as an "in-place" marshalling. |
aoqi@0 | 268 | * The difference is that instead of creating a whole new XML tree, |
aoqi@0 | 269 | * this operation updates an existing tree while trying to preserve |
aoqi@0 | 270 | * the XML as much as possible. |
aoqi@0 | 271 | * |
aoqi@0 | 272 | * <p> |
aoqi@0 | 273 | * For example, unknown elements/attributes in XML that were not bound |
aoqi@0 | 274 | * to JAXB will be left untouched (whereas a marshalling operation |
aoqi@0 | 275 | * would create a new tree that doesn't contain any of those.) |
aoqi@0 | 276 | * |
aoqi@0 | 277 | * <p> |
aoqi@0 | 278 | * As a side-effect, this operation updates the association between |
aoqi@0 | 279 | * XML nodes and JAXB objects. |
aoqi@0 | 280 | * |
aoqi@0 | 281 | * @param jaxbObject root of potentially modified JAXB object tree |
aoqi@0 | 282 | * @param xmlNode root of update target XML parse tree |
aoqi@0 | 283 | * |
aoqi@0 | 284 | * @return |
aoqi@0 | 285 | * Returns the updated XML node. Typically, this is the same |
aoqi@0 | 286 | * node you passed in as <i>xmlNode</i>, but it maybe |
aoqi@0 | 287 | * a different object, for example when the tag name of the object |
aoqi@0 | 288 | * has changed. |
aoqi@0 | 289 | * |
aoqi@0 | 290 | * @throws JAXBException |
aoqi@0 | 291 | * If any unexpected problem occurs updating corresponding XML content. |
aoqi@0 | 292 | * @throws IllegalArgumentException |
aoqi@0 | 293 | * If any of the input parameters are null |
aoqi@0 | 294 | */ |
aoqi@0 | 295 | public abstract XmlNode updateXML( Object jaxbObject, XmlNode xmlNode ) throws JAXBException; |
aoqi@0 | 296 | |
aoqi@0 | 297 | /** |
aoqi@0 | 298 | * Takes an XML node and updates its associated JAXB object and its descendants. |
aoqi@0 | 299 | * |
aoqi@0 | 300 | * <p> |
aoqi@0 | 301 | * This operation can be thought of as an "in-place" unmarshalling. |
aoqi@0 | 302 | * The difference is that instead of creating a whole new JAXB tree, |
aoqi@0 | 303 | * this operation updates an existing tree, reusing as much JAXB objects |
aoqi@0 | 304 | * as possible. |
aoqi@0 | 305 | * |
aoqi@0 | 306 | * <p> |
aoqi@0 | 307 | * As a side-effect, this operation updates the association between |
aoqi@0 | 308 | * XML nodes and JAXB objects. |
aoqi@0 | 309 | * |
aoqi@0 | 310 | * @return |
aoqi@0 | 311 | * Returns the updated JAXB object. Typically, this is the same |
aoqi@0 | 312 | * object that was returned from earlier |
aoqi@0 | 313 | * {@link #marshal(Object,Object)} or |
aoqi@0 | 314 | * {@link #updateJAXB(Object)} method invocation, |
aoqi@0 | 315 | * but it maybe |
aoqi@0 | 316 | * a different object, for example when the name of the XML |
aoqi@0 | 317 | * element has changed. |
aoqi@0 | 318 | * |
aoqi@0 | 319 | * @throws JAXBException |
aoqi@0 | 320 | * If any unexpected problem occurs updating corresponding JAXB mapped content. |
aoqi@0 | 321 | * @throws IllegalArgumentException |
aoqi@0 | 322 | * If node parameter is null |
aoqi@0 | 323 | */ |
aoqi@0 | 324 | public abstract Object updateJAXB( XmlNode xmlNode ) throws JAXBException; |
aoqi@0 | 325 | |
aoqi@0 | 326 | |
aoqi@0 | 327 | /** |
aoqi@0 | 328 | * Specifies whether marshal, unmarshal and update methods |
aoqi@0 | 329 | * performs validation on their XML content. |
aoqi@0 | 330 | * |
aoqi@0 | 331 | * @param schema set to null to disable validation. |
aoqi@0 | 332 | * |
aoqi@0 | 333 | * @see Unmarshaller#setSchema(Schema) |
aoqi@0 | 334 | */ |
aoqi@0 | 335 | public abstract void setSchema( Schema schema ); |
aoqi@0 | 336 | |
aoqi@0 | 337 | /** |
aoqi@0 | 338 | * Gets the last {@link Schema} object (including null) set by the |
aoqi@0 | 339 | * {@link #setSchema(Schema)} method. |
aoqi@0 | 340 | * |
aoqi@0 | 341 | * @return the Schema object for validation or null if not present |
aoqi@0 | 342 | */ |
aoqi@0 | 343 | public abstract Schema getSchema(); |
aoqi@0 | 344 | |
aoqi@0 | 345 | /** |
aoqi@0 | 346 | * Allow an application to register a <tt>ValidationEventHandler</tt>. |
aoqi@0 | 347 | * <p> |
aoqi@0 | 348 | * The <tt>ValidationEventHandler</tt> will be called by the JAXB Provider |
aoqi@0 | 349 | * if any validation errors are encountered during calls to any of the |
aoqi@0 | 350 | * Binder unmarshal, marshal and update methods. |
aoqi@0 | 351 | * |
aoqi@0 | 352 | * <p> |
aoqi@0 | 353 | * Calling this method with a null parameter will cause the Binder |
aoqi@0 | 354 | * to revert back to the default default event handler. |
aoqi@0 | 355 | * |
aoqi@0 | 356 | * @param handler the validation event handler |
aoqi@0 | 357 | * @throws JAXBException if an error was encountered while setting the |
aoqi@0 | 358 | * event handler |
aoqi@0 | 359 | */ |
aoqi@0 | 360 | public abstract void setEventHandler( ValidationEventHandler handler ) throws JAXBException; |
aoqi@0 | 361 | |
aoqi@0 | 362 | /** |
aoqi@0 | 363 | * Return the current event handler or the default event handler if one |
aoqi@0 | 364 | * hasn't been set. |
aoqi@0 | 365 | * |
aoqi@0 | 366 | * @return the current ValidationEventHandler or the default event handler |
aoqi@0 | 367 | * if it hasn't been set |
aoqi@0 | 368 | * @throws JAXBException if an error was encountered while getting the |
aoqi@0 | 369 | * current event handler |
aoqi@0 | 370 | */ |
aoqi@0 | 371 | public abstract ValidationEventHandler getEventHandler() throws JAXBException; |
aoqi@0 | 372 | |
aoqi@0 | 373 | /** |
aoqi@0 | 374 | * |
aoqi@0 | 375 | * Set the particular property in the underlying implementation of |
aoqi@0 | 376 | * <tt>Binder</tt>. This method can only be used to set one of |
aoqi@0 | 377 | * the standard JAXB defined unmarshal/marshal properties |
aoqi@0 | 378 | * or a provider specific property for binder, unmarshal or marshal. |
aoqi@0 | 379 | * Attempting to set an undefined property will result in |
aoqi@0 | 380 | * a PropertyException being thrown. See |
aoqi@0 | 381 | * <a href="Unmarshaller.html#supportedProps">Supported Unmarshal Properties</a> |
aoqi@0 | 382 | * and |
aoqi@0 | 383 | * <a href="Marshaller.html#supportedProps">Supported Marshal Properties</a>. |
aoqi@0 | 384 | * |
aoqi@0 | 385 | * @param name the name of the property to be set. This value can either |
aoqi@0 | 386 | * be specified using one of the constant fields or a user |
aoqi@0 | 387 | * supplied string. |
aoqi@0 | 388 | * @param value the value of the property to be set |
aoqi@0 | 389 | * |
aoqi@0 | 390 | * @throws PropertyException when there is an error processing the given |
aoqi@0 | 391 | * property or value |
aoqi@0 | 392 | * @throws IllegalArgumentException |
aoqi@0 | 393 | * If the name parameter is null |
aoqi@0 | 394 | */ |
aoqi@0 | 395 | abstract public void setProperty( String name, Object value ) throws PropertyException; |
aoqi@0 | 396 | |
aoqi@0 | 397 | |
aoqi@0 | 398 | /** |
aoqi@0 | 399 | * Get the particular property in the underlying implementation of |
aoqi@0 | 400 | * <tt>Binder</tt>. This method can only |
aoqi@0 | 401 | * be used to get one of |
aoqi@0 | 402 | * the standard JAXB defined unmarshal/marshal properties |
aoqi@0 | 403 | * or a provider specific property for binder, unmarshal or marshal. |
aoqi@0 | 404 | * Attempting to get an undefined property will result in |
aoqi@0 | 405 | * a PropertyException being thrown. See |
aoqi@0 | 406 | * <a href="Unmarshaller.html#supportedProps">Supported Unmarshal Properties</a> |
aoqi@0 | 407 | * and |
aoqi@0 | 408 | * <a href="Marshaller.html#supportedProps">Supported Marshal Properties</a>. |
aoqi@0 | 409 | * |
aoqi@0 | 410 | * @param name the name of the property to retrieve |
aoqi@0 | 411 | * @return the value of the requested property |
aoqi@0 | 412 | * |
aoqi@0 | 413 | * @throws PropertyException |
aoqi@0 | 414 | * when there is an error retrieving the given property or value |
aoqi@0 | 415 | * property name |
aoqi@0 | 416 | * @throws IllegalArgumentException |
aoqi@0 | 417 | * If the name parameter is null |
aoqi@0 | 418 | */ |
aoqi@0 | 419 | abstract public Object getProperty( String name ) throws PropertyException; |
aoqi@0 | 420 | |
aoqi@0 | 421 | } |