< prev index next >

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

Print this page




  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.JAXBContextFactory;
  29 import javax.xml.bind.JAXBException;
  30 import javax.xml.bind.Marshaller;
  31 import javax.xml.bind.Unmarshaller;
  32 import javax.xml.bind.Validator;
  33 
  34 /**
  35  * @test
  36  * @bug 8150173
  37  * @summary Verifies that a factory which inherit its createContext method
  38  *          from a concrete subclass of JAXBContextFactory is be instantiated.
  39  * @compile -addmods java.xml.bind JAXBContextWithSubclassedFactory.java
  40  * @run main/othervm -addmods java.xml.bind JAXBContextWithSubclassedFactory
  41  */
  42 public class JAXBContextWithSubclassedFactory {
  43     static JAXBContext tmp;
  44 
  45     public static class JAXBContextImpl extends JAXBContext {
  46         public final Class<?> creator;
  47         JAXBContextImpl(Class<?> creator) {
  48             this.creator = creator;
  49         }
  50 
  51         @Override
  52         public Unmarshaller createUnmarshaller() throws JAXBException {
  53             return tmp.createUnmarshaller();
  54         }
  55 
  56         @Override
  57         public Marshaller createMarshaller() throws JAXBException {
  58             return tmp.createMarshaller();
  59         }
  60 




  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.JAXBContextFactory;
  29 import javax.xml.bind.JAXBException;
  30 import javax.xml.bind.Marshaller;
  31 import javax.xml.bind.Unmarshaller;
  32 import javax.xml.bind.Validator;
  33 
  34 /**
  35  * @test
  36  * @bug 8150173
  37  * @summary Verifies that a factory which inherit its createContext method
  38  *          from a concrete subclass of JAXBContextFactory is be instantiated.
  39  * @modules java.xml.bind
  40  * @run main/othervm JAXBContextWithSubclassedFactory
  41  */
  42 public class JAXBContextWithSubclassedFactory {
  43     static JAXBContext tmp;
  44 
  45     public static class JAXBContextImpl extends JAXBContext {
  46         public final Class<?> creator;
  47         JAXBContextImpl(Class<?> creator) {
  48             this.creator = creator;
  49         }
  50 
  51         @Override
  52         public Unmarshaller createUnmarshaller() throws JAXBException {
  53             return tmp.createUnmarshaller();
  54         }
  55 
  56         @Override
  57         public Marshaller createMarshaller() throws JAXBException {
  58             return tmp.createMarshaller();
  59         }
  60 


< prev index next >