< prev index next >

jdk/test/javax/xml/bind/JAXBContext/JAXBContextWithLegacyFactory.java

Print this page




  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 import java.security.Permission;
  24 import java.security.Policy;
  25 import java.security.ProtectionDomain;
  26 import java.util.Map;
  27 import javax.xml.bind.JAXBContext;
  28 import javax.xml.bind.JAXBException;
  29 import javax.xml.bind.Marshaller;
  30 import javax.xml.bind.Unmarshaller;
  31 import javax.xml.bind.Validator;
  32 
  33 /**
  34  * @test
  35  * @bug 8150173
  36  * @summary Verifies that a JAXBContext can be created with a legacy
  37  *          factory class that has static createContext methods.
  38  * @compile -addmods java.xml.bind JAXBContextWithLegacyFactory.java
  39  * @run main/othervm -addmods java.xml.bind JAXBContextWithLegacyFactory
  40  */
  41 public class JAXBContextWithLegacyFactory {
  42     private static JAXBContext tmp;
  43 
  44         public static class JAXBContextImpl extends JAXBContext {
  45         public final Class<?> creator;
  46         JAXBContextImpl(Class<?> creator) {
  47             this.creator = creator;
  48         }
  49 
  50         @Override
  51         public Unmarshaller createUnmarshaller() throws JAXBException {
  52             return tmp.createUnmarshaller();
  53         }
  54 
  55         @Override
  56         public Marshaller createMarshaller() throws JAXBException {
  57             return tmp.createMarshaller();
  58         }
  59 




  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 import java.security.Permission;
  24 import java.security.Policy;
  25 import java.security.ProtectionDomain;
  26 import java.util.Map;
  27 import javax.xml.bind.JAXBContext;
  28 import javax.xml.bind.JAXBException;
  29 import javax.xml.bind.Marshaller;
  30 import javax.xml.bind.Unmarshaller;
  31 import javax.xml.bind.Validator;
  32 
  33 /**
  34  * @test
  35  * @bug 8150173
  36  * @summary Verifies that a JAXBContext can be created with a legacy
  37  *          factory class that has static createContext methods.
  38  * @modules java.xml.bind
  39  * @run main/othervm JAXBContextWithLegacyFactory
  40  */
  41 public class JAXBContextWithLegacyFactory {
  42     private static JAXBContext tmp;
  43 
  44         public static class JAXBContextImpl extends JAXBContext {
  45         public final Class<?> creator;
  46         JAXBContextImpl(Class<?> creator) {
  47             this.creator = creator;
  48         }
  49 
  50         @Override
  51         public Unmarshaller createUnmarshaller() throws JAXBException {
  52             return tmp.createUnmarshaller();
  53         }
  54 
  55         @Override
  56         public Marshaller createMarshaller() throws JAXBException {
  57             return tmp.createMarshaller();
  58         }
  59 


< prev index next >