src/share/jaxws_classes/com/sun/xml/internal/ws/message/jaxb/MarshallerBridge.java

Thu, 31 Aug 2017 15:18:52 +0800

author
aoqi
date
Thu, 31 Aug 2017 15:18:52 +0800
changeset 637
9c07ef4934dd
parent 368
0989ad8c0860
parent 0
373ffda63c9a
permissions
-rw-r--r--

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.xml.internal.ws.message.jaxb;
    28 import com.sun.xml.internal.bind.api.Bridge;
    29 import com.sun.xml.internal.bind.api.JAXBRIContext;
    30 import com.sun.xml.internal.bind.api.TypeReference;
    31 import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl;
    32 import com.sun.xml.internal.bind.v2.runtime.MarshallerImpl;
    33 import org.w3c.dom.Node;
    34 import org.xml.sax.ContentHandler;
    36 import javax.xml.bind.JAXBException;
    37 import javax.xml.bind.Marshaller;
    38 import javax.xml.bind.Unmarshaller;
    39 import javax.xml.namespace.NamespaceContext;
    40 import javax.xml.stream.XMLStreamReader;
    41 import javax.xml.stream.XMLStreamWriter;
    42 import javax.xml.transform.Result;
    43 import javax.xml.transform.Source;
    44 import java.io.InputStream;
    45 import java.io.OutputStream;
    47 /**
    48  * Used to adapt {@link Marshaller} into a {@link Bridge}.
    49  * @deprecated
    50  * @author Kohsuke Kawaguchi
    51  */
    52 final class MarshallerBridge extends Bridge {
    53     public MarshallerBridge(JAXBRIContext context) {
    54         super((JAXBContextImpl)context);
    55     }
    57     public void marshal(Marshaller m, Object object, XMLStreamWriter output) throws JAXBException {
    58         m.setProperty(Marshaller.JAXB_FRAGMENT,true);
    59         try {
    60             m.marshal(object,output);
    61         } finally {
    62             m.setProperty(Marshaller.JAXB_FRAGMENT,false);
    63         }
    64     }
    66     public void marshal(Marshaller m, Object object, OutputStream output, NamespaceContext nsContext) throws JAXBException {
    67         m.setProperty(Marshaller.JAXB_FRAGMENT,true);
    68         try {
    69             ((MarshallerImpl)m).marshal(object,output,nsContext);
    70         } finally {
    71             m.setProperty(Marshaller.JAXB_FRAGMENT,false);
    72         }
    73     }
    75     public void marshal(Marshaller m, Object object, Node output) throws JAXBException {
    76         m.setProperty(Marshaller.JAXB_FRAGMENT,true);
    77         try {
    78             m.marshal(object,output);
    79         } finally {
    80             m.setProperty(Marshaller.JAXB_FRAGMENT,false);
    81         }
    82     }
    84     public void marshal(Marshaller m, Object object, ContentHandler contentHandler) throws JAXBException {
    85         m.setProperty(Marshaller.JAXB_FRAGMENT,true);
    86         try {
    87             m.marshal(object,contentHandler);
    88         } finally {
    89             m.setProperty(Marshaller.JAXB_FRAGMENT,false);
    90         }
    91     }
    93     public void marshal(Marshaller m, Object object, Result result) throws JAXBException {
    94         m.setProperty(Marshaller.JAXB_FRAGMENT,true);
    95         try {
    96             m.marshal(object,result);
    97         } finally {
    98             m.setProperty(Marshaller.JAXB_FRAGMENT,false);
    99         }
   100     }
   102     public Object unmarshal(Unmarshaller u, XMLStreamReader in) {
   103         throw new UnsupportedOperationException();
   104     }
   106     public Object unmarshal(Unmarshaller u, Source in) {
   107         throw new UnsupportedOperationException();
   108     }
   110     public Object unmarshal(Unmarshaller u, InputStream in) {
   111         throw new UnsupportedOperationException();
   112     }
   114     public Object unmarshal(Unmarshaller u, Node n) {
   115         throw new UnsupportedOperationException();
   116     }
   118     public TypeReference getTypeReference() {
   119         throw new UnsupportedOperationException();
   120     }
   121 }

mercurial