Example usage for org.joda.time Partial getChronology

List of usage examples for org.joda.time Partial getChronology

Introduction

In this page you can find the example usage for org.joda.time Partial getChronology.

Prototype

public Chronology getChronology() 

Source Link

Document

Gets the chronology of the partial which is never null.

Usage

From source file:TVShowTimelineMaker.util.XML.PartialXMLWriter.java

@Override
public Element writeElements(Partial ObjectToWrite) {
    Element newElement = new Element("Partial");
    JodaTimeUtil timeUtil = JodaTimeUtil.getInstance();
    DateTimeFieldType[] fieldTypes = ObjectToWrite.getFieldTypes();
    int[] values = ObjectToWrite.getValues();
    DateTimeZone zone = ObjectToWrite.getChronology().getZone();
    Element TimeZoneElement = new Element("TimeZone");
    TimeZoneElement.setText(timeUtil.getStringForDateTimeZone(zone));
    newElement.addContent(TimeZoneElement);
    Chronology chronology = ObjectToWrite.getChronology();
    Element ChronologyElement = new Element("Chronology");
    ChronologyElement.setText(timeUtil.getStringForChronology(chronology));
    newElement.addContent(ChronologyElement);
    Element FieldsElement = new Element("Fields");
    for (int i = 0; i < fieldTypes.length; i++) {
        Element KeyValuePairElement = new Element("KeyValuePair");
        Element KeyElement = new Element("Key");
        KeyElement.setText(timeUtil.getStringForDateTimeFieldType(fieldTypes[i]));
        Element ValueElement = new Element("Value");
        ValueElement.setText(java.lang.Integer.toString(values[i]));
        KeyValuePairElement.addContent(KeyElement);
        KeyValuePairElement.addContent(ValueElement);
        FieldsElement.addContent(KeyValuePairElement);
    }/*w  ww  . j ava2 s .c  om*/
    newElement.addContent(FieldsElement);
    return newElement;
}