Examples of JAXBSource


Examples of javax.xml.bind.util.JAXBSource

                    }
                    updateOutputAction("Matches");
                    if (mapToOld) {
                        ret = mapToOld(doc, factory.createProbeMatches(pmt));
                    } else {
                        ret = new JAXBSource(context, factory.createProbeMatches(pmt));
                    }
                } else if (obj instanceof ResolveType) {
                    ResolveMatchesType rmt = handleResolve((ResolveType)obj);
                    if (rmt == null) {
                        return null;
                    }
                    updateOutputAction("Matches");
                    if (mapToOld) {
                        ret = mapToOld(doc, factory.createResolveMatches(rmt));
                    } else {
                        ret = new JAXBSource(context, factory.createResolveMatches(rmt));
                    }
                } else if (obj instanceof HelloType) {
                    //check if it's a DiscoveryProxy
                    HelloType h = (HelloType)obj;
                    if (h.getTypes().contains(WSDiscoveryClient.SERVICE_QNAME)
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

        this.jaxbConverter = jaxbConverter;
    }

    public static JAXBSource toSource(@HasAnnotation(XmlRootElement.class)Object value) throws JAXBException {
        JAXBContext context = createJaxbContext(value);
        return new JAXBSource(context, value);
    }
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

    protected <T> T marshall(Class<T> type, Object value) throws JAXBException {
        if (parentTypeConverter != null) {
            // lets convert the object to a JAXB source and try convert that to
            // the required source
            JAXBContext context = createContext(value.getClass());
            JAXBSource source = new JAXBSource(context, value);
            T answer = parentTypeConverter.convertTo(type, source);
            if (answer == null) {
                // lets try a stream
                StringWriter buffer = new StringWriter();
                Marshaller marshaller = context.createMarshaller();
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

    protected <T> T marshall(Class<T> type, Object value) throws JAXBException {
        if (parentTypeConverter != null) {
            // lets convert the object to a JAXB source and try convert that to
            // the required source
            JAXBContext context = createContext(value.getClass());
            JAXBSource source = new JAXBSource(context, value);
            try {
                return parentTypeConverter.convertTo(type, source);
            } catch (NoTypeConversionAvailableException e) {
                // lets try a stream
                StringWriter buffer = new StringWriter();
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

    generateSchema(bos);
    try {
      final SpringApplicationService springApplicationService = (SpringApplicationService) u.unmarshal(xml);
      final Schema schema = schemaFactory.newSchema(new StreamSource(new ByteArrayInputStream(bos.toByteArray())));
      final Validator validator = schema.newValidator();
      validator.validate(new JAXBSource(jc, springApplicationService));
      return springApplicationService;
    } catch (SAXException | IOException e) {
      throw new IllegalArgumentException("Failed to parse XML. The XML must conform to the following schema:\n" + bos, e);
    }
  }
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

    protected <T> T marshall(Class<T> type, Object value) throws JAXBException {
        if (parentTypeConverter != null) {
            // lets convert the object to a JAXB source and try convert that to
            // the required source
            JAXBContext context = createContext(value.getClass());
            JAXBSource source = new JAXBSource(context, value);
            try {
                return parentTypeConverter.convertTo(type, source);
            } catch (NoTypeConversionAvailableException e) {
                // lets try a stream
                StringWriter buffer = new StringWriter();
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

    }

    @Converter
    public JAXBSource toSource(@HasAnnotation(XmlRootElement.class)Object value) throws JAXBException {
        JAXBContext context = getJaxbContext(value);
        return new JAXBSource(context, value);
    }
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

                    }
                    updateOutputAction("Matches");
                    if (mapToOld) {
                        ret = mapToOld(doc, factory.createProbeMatches(pmt));
                    } else {
                        ret = new JAXBSource(context, factory.createProbeMatches(pmt));
                    }
                } else if (obj instanceof ResolveType) {
                    ResolveMatchesType rmt = handleResolve((ResolveType)obj);
                    if (rmt == null) {
                        return null;
                    }
                    updateOutputAction("Matches");
                    if (mapToOld) {
                        ret = mapToOld(doc, factory.createResolveMatches(rmt));
                    } else {
                        ret = new JAXBSource(context, factory.createResolveMatches(rmt));
                    }
                } else if (obj instanceof HelloType) {
                    //check if it's a DiscoveryProxy
                    HelloType h = (HelloType)obj;
                    if (h.getTypes().contains(WSDiscoveryClient.SERVICE_QNAME)
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

                if (obj instanceof ProbeType) {
                    ProbeMatchesType pmt = handleProbe((ProbeType)obj);
                    if (pmt == null) {
                        return null;
                    }
                    return new JAXBSource(context, factory.createProbeMatches(pmt));
                } else if (obj instanceof HelloType) {
                    //check if it's a DiscoveryProxy
                    HelloType h = (HelloType)obj;
                    if (h.getTypes().contains(WSDiscoveryClient.SERVICE_QNAME)
                        || h.getTypes().contains(new QName("", WSDiscoveryClient.SERVICE_QNAME.getLocalPart()))) {
View Full Code Here

Examples of javax.xml.bind.util.JAXBSource

            throw new IllegalArgumentException("Cannot convert from null value to JAXBSource");
        }
        // just need to check if the Object class has the XmlRootElement
        if (value.getClass().getAnnotation(XmlRootElement.class) != null) {
            JAXBContext context = getJaxbContext(value);
            return new JAXBSource(context, value);
        } else {
            return null;
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.