@Test @Ignore public void testFile() throws JAXBException, SAXException, IOException, Exception { XmlNationalCalendar xcal1 = new XmlNationalCalendar(); xcal1.setName("calendar.test1"); XmlFixedDay fday = new XmlFixedDay(); fday.setMonth(Month.March); fday.setDay(21); XmlSpecialDayEvent sday = new XmlSpecialDayEvent(); sday.setDay(fday); xcal1.getSpecialDayEvent().add(sday); XmlNationalCalendar xcal2 = new XmlNationalCalendar(); xcal2.setName("calendar.test2"); xcal2.getSpecialDayEvent().add(sday); XmlChainedCalendar xchained = new XmlChainedCalendar(); xchained.setCalendarBreak(Day.toDay()); xchained.setStartCalendar(xcal1.getName()); xchained.setEndCalendar(xcal2.getName()); xchained.setName("calendar.chained"); XmlCompositeCalendar xcomposite = new XmlCompositeCalendar(); xcomposite.getWeightedCalendar().add(new XmlWeightedItem(xcal1.getName())); xcomposite.getWeightedCalendar().add(new XmlWeightedItem(xcal2.getName())); xcomposite.getWeightedCalendar().add(new XmlWeightedItem(xchained.getName())); xcomposite.setName("calendar.composite"); XmlCalendars xcals = new XmlCalendars(); xcals.getCalendars().add(xcal1); xcals.getCalendars().add(xcal2); xcals.getCalendars().add(xchained); xcals.getCalendars().add(xcomposite); JAXBContext jaxb = JAXBContext.newInstance(xcals.getClass()); FileOutputStream ostream = new FileOutputStream(FILE); try (OutputStreamWriter writer = new OutputStreamWriter(ostream, StandardCharsets.UTF_8)) { Marshaller marshaller = jaxb.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); marshaller.marshal(xcals, writer); writer.flush(); } }
public List<XmlCalendar> getCalendars() { if (calendar == null) { calendar = new ArrayList<>(); } return this.calendar; }
XmlCalendars { public List<XmlCalendar> getCalendars() { if (calendar == null) { calendar = new ArrayList<>(); } return this.calendar; } }
XmlCalendars { public List<XmlCalendar> getCalendars() { if (calendar == null) { calendar = new ArrayList<>(); } return this.calendar; }  }
XmlCalendars { public List<XmlCalendar> getCalendars() { if (calendar == null) { calendar = new ArrayList<>(); } return this.calendar; }  List<XmlCalendar> getCalendars(); }
XmlCalendars { public List<XmlCalendar> getCalendars() { if (calendar == null) { calendar = new ArrayList<>(); } return this.calendar; }  List<XmlCalendar> getCalendars();  }