Java XML JAXB Object to XML getObjects(List> objEls)

Here you can find the source of getObjects(List> objEls)

Description

Get the list of T from list of JAXBElement .

License

Open Source License

Parameter

Parameter Description
T Type.
objEls List of JAXBElements.

Return

List of T .

Declaration

public static <T> List<T> getObjects(List<JAXBElement<T>> objEls) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.JAXBElement;

public class Main {
    /**/*from  w ww.  j  ava2s .co  m*/
     * Get the list of {@code T} from list of {@code JAXBElement<T>}.
     * @param <T> Type.
     * @param objEls List of JAXBElements.
     * @return List of {@code T}.
     */
    public static <T> List<T> getObjects(List<JAXBElement<T>> objEls) {
        List<T> list = new ArrayList<T>();

        for (JAXBElement<? extends T> objEl : objEls) {
            list.add(objEl.getValue());
        }

        return list;
    }
}

Related

  1. convertToString(Object obj)
  2. convertToXml(Object obj)
  3. convertToXml(Object obj)
  4. convertToXml(Object obj, String encoding)
  5. createXML(Object o)
  6. getObjects(List objEls)
  7. getXmlString(JAXBElement versioningInfo, Boolean formatXml, Schema schema)
  8. getXMLString(Object person, Class clazz)
  9. getXmlString(T jaxbObject)