Example usage for org.joda.time Partial getValues

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

Introduction

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

Prototype

public int[] getValues() 

Source Link

Document

Gets an array of the value of each of the fields that this partial supports.

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);
    }/*  ww w  .j  a v  a 2s  .  c  o  m*/
    newElement.addContent(FieldsElement);
    return newElement;
}