Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Marshaller;

import java.io.File;

public class Main {
    public static <T> void marshall(String file, JAXBElement<T> object, Class context) throws Exception {
        JAXBContext ctx = JAXBContext.newInstance(context);
        Marshaller marshaller = ctx.createMarshaller();
        marshaller.marshal(object, new File(file));
    }
}