set Xml Gregorian Calendar - Java XML

Java examples for XML:XML Calendar

Description

set Xml Gregorian Calendar

Demo Code


//package com.java2s;

import javax.xml.datatype.XMLGregorianCalendar;

public class Main {
    /**//from   w  w w .j  a v a 2 s. co  m
     * @param xmlGregorianCalendar xml gregorian calendar
     * @param year year
     * @param month month
     * @param date date
     * @return boolean check
     */
    public static Boolean setXmlGregorianCalendar(
            XMLGregorianCalendar xmlGregorianCalendar, int year, int month,
            int date) {

        Boolean isGregorianCalendarValide = null;

        if (xmlGregorianCalendar == null) {
            isGregorianCalendarValide = false;
            throw new NullPointerException("gregorian calendar null");
        }

        xmlGregorianCalendar.setYear(year);
        xmlGregorianCalendar.setMonth(month);
        xmlGregorianCalendar.setDay(date);

        isGregorianCalendarValide = true;

        return isGregorianCalendarValide;
    }
}

Related Tutorials