Java XML JAXB Unmarshaller getUnmarshaller()

Here you can find the source of getUnmarshaller()

Description

get Unmarshaller

License

Open Source License

Declaration

public static Unmarshaller getUnmarshaller() 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2011 Greg Riccardi, Guillaume Jimenez.
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the GNU Public License v2.0
 *  which accompanies this distribution, and is available at
 *  http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 *  //  w  ww.  j  av  a 2  s.c  om
 *  Contributors:
 *     Greg Riccardi - initial API and implementation
 *    Guillaume Jimenez - initial API and implementation
 ******************************************************************************/

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;

import javax.xml.bind.Unmarshaller;

public class Main {
    public static final String REQ_PKG = "net.morphbank.mbsvc3.xml";
    static JAXBContext jc = null;
    static Unmarshaller unmarshaller = null;

    public static Unmarshaller getUnmarshaller() {
        if (unmarshaller != null) {
            return unmarshaller;
        }
        try {
            if (jc == null) {
                jc = JAXBContext.newInstance(REQ_PKG);
            }
            unmarshaller = jc.createUnmarshaller();
            return unmarshaller;
        } catch (JAXBException e) {
            e.printStackTrace();
            return null;
        }
    }
}

Related

  1. createUnmarshaller(Class jaxbBindClass)
  2. createUnmarshaller(Class clazz)
  3. createUnmarshaller(Class clazz)
  4. createUnmarshaller(Class clazz)
  5. createUnmarshaller(Object object)
  6. getUnmarshaller()
  7. getUnmarshaller()
  8. getUnmarshaller(Class jaxbClass)
  9. marshallUnmarshall(T inObj)