List of usage examples for java.time Year toString
@Override
public String toString()
From source file:Main.java
public static void main(String[] args) { Year y = Year.of(2014); System.out.println(y.toString()); }
From source file:it.reexon.lib.gpx.runtastic.parser.GpxRuntasticParser.java
private void analyzesMetadataNode(Node node) throws DOMException, URISyntaxException { MetadataType metadataType = new MetadataType(); if (node.getNodeType() == Node.ELEMENT_NODE) { Element metadataElement = (Element) node; // ---------------------------- Copyright ---------------------------- NodeList copyright = metadataElement.getElementsByTagName("copyright"); CopyrightType copyrightType = new CopyrightType(); if (copyright.getLength() == 1) { Node copyrightNode = copyright.item(0); copyrightType.setAuthor(copyrightNode.getAttributes().getNamedItem("author").getNodeValue()); }/*from ww w . ja v a2s . com*/ Year year = Year.of( new Integer(metadataElement.getElementsByTagName("year").item(0).getTextContent()).intValue()); URI licence = new URI(metadataElement.getElementsByTagName("license").item(0).getTextContent()); System.out.println("Year: " + year.toString()); System.out.println("License: " + licence.toString()); // ---------------------------- Link ---------------------------- NodeList link = metadataElement.getElementsByTagName("link"); LinkType linkType = new LinkType(); if (link.getLength() == 1) { Node linkNode = link.item(0); linkType.setAnyURI(new URI(linkNode.getAttributes().getNamedItem("href").getNodeValue())); } String text = metadataElement.getElementsByTagName("text").item(0).getTextContent(); linkType.setText(text); System.out.println("Text: " + text); Date time = new DateTime(metadataElement.getElementsByTagName("time").item(0).getTextContent()) .toDate(); System.out.println("Time: " + time.toString()); copyrightType.setYear(year); copyrightType.setLicence(licence); metadataType.setCopyright(copyrightType); metadataType.setTime(time); gpx.setMetadata(metadataType); } }