Package javax.xml.bind

Examples of javax.xml.bind.Unmarshaller


   public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException
   {
      try
      {
         JAXBContext jaxb = findJAXBContext(type, annotations, mediaType, true);
         Unmarshaller unmarshaller = jaxb.createUnmarshaller();
         Object obj = unmarshaller.unmarshal(entityStream);
         if (obj instanceof JAXBElement)
         {
            JAXBElement element = (JAXBElement) obj;
            return element.getValue();
View Full Code Here


                                               InputStream entityStream,
                                               XMLStreamReader reader)
   {
      try
      {
         Unmarshaller unmarshaller = jaxb.createUnmarshaller();
         JAXBElement<T> e = unmarshaller.unmarshal(reader, type);
         return e;
      }
      catch (JAXBException e)
      {
         throw new ExceptionAdapter(e);
View Full Code Here

      logger.error("Could not find resource: " + fileName);
    } else {
      InputStream resourceStream =url.openStream();
 
      JAXBContext jc = JAXBContext.newInstance(thePackage);
      Unmarshaller unmarshaller = jc.createUnmarshaller();
      obj = ((JAXBElement)unmarshaller.unmarshal(resourceStream)).getValue();
    }
    return obj;
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  public static Object buildFromString(String source, String thePackage) throws JAXBException, IOException {
    Object obj = null;
    JAXBContext jc = JAXBContext.newInstance(thePackage);
    Unmarshaller unmarshaller = jc.createUnmarshaller();
    obj = ((JAXBElement)unmarshaller.unmarshal(new StringReader(source)));
    return obj;
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  public static Object unmarshallFromInputStream(InputStream inputStream, String thePackage) throws JAXBException {
    Object obj = null;
    if (inputStream != null) {
      JAXBContext jc = JAXBContexts.get(thePackage);
      Unmarshaller unmarshaller = jc.createUnmarshaller();
      obj = ((JAXBElement)unmarshaller.unmarshal(inputStream)).getValue();
    }
    else
      logger.error("A null input stream was provided");

    return obj;
View Full Code Here

  }
 
  @SuppressWarnings("unchecked")
  public static Object unmarshallFromElement(Element element, String thePackage) throws JAXBException {
    JAXBContext jc = JAXBContexts.get(thePackage);
    Unmarshaller unmarshaller = jc.createUnmarshaller();
    Object obj = ((JAXBElement) unmarshaller.unmarshal(element)).getValue();
    return obj;
  }
View Full Code Here

   public void testUnmarshalOrdertype() throws Exception
   {
      InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(
              "order_123.xml");
      JAXBContext jaxb = JAXBContext.newInstance(Ordertype.class);
      Unmarshaller u = jaxb.createUnmarshaller();
      Ordertype order = (Ordertype) u.unmarshal(in);
      Assert.assertNotNull(order);
      Assert.assertEquals("Ryan J. McDonough", order.getPerson());
   }
View Full Code Here

    return !jsInstallationsIterator.hasNext();
   }

  public void readInstallationDefinitionFile() throws JAXBException  {
   JAXBContext context = JAXBContext.newInstance( Installations.class );
   Unmarshaller unmarshaller = context.createUnmarshaller();
   installations = (Installations) unmarshaller.unmarshal( installationsDefinitionFile );
   listOfInstallations = (ArrayList)installations.getInstallation();
   reset();
   }
View Full Code Here

  }

  public OServerConfiguration load() throws IOException {
    try {
      context = JAXBContext.newInstance(rootClass);
      Unmarshaller unmarshaller = context.createUnmarshaller();
      unmarshaller.setSchema(null);

      final OServerConfiguration obj;

      if (file != null) {
        if (file.exists())
          obj = rootClass.cast(unmarshaller.unmarshal(file));
        else
          return rootClass.getConstructor(OServerConfigurationLoaderXml.class, String.class).newInstance(this, file);
        obj.location = file.getAbsolutePath();
      } else {
        obj = rootClass.cast(unmarshaller.unmarshal(new StringReader(configurationText)));
        obj.location = "memory";
      }

      // AUTO CONFIGURE SYSTEM CONFIGURATION
      OGlobalConfiguration config;
View Full Code Here

    List<SoapEventMap> events = new ArrayList<SoapEventMap>();

    try {
      JAXBContext jcontext = JAXBContext.newInstance(this.eventPkg);

      Unmarshaller unmarshaller = jcontext.createUnmarshaller();

      if (this.elements != null) {
        for (Element element : this.elements) {
          if (element != null) {
            SoapEventMap event = new SoapEventMap();
View Full Code Here

TOP

Related Classes of javax.xml.bind.Unmarshaller

Copyright © 2018 www.massapicom. 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.