Example usage for org.joda.time Partial Partial

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

Introduction

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

Prototype

Partial(Chronology chronology, DateTimeFieldType[] types, int[] values) 

Source Link

Document

Constructs a Partial with the specified chronology, fields and values.

Usage

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

@Override
public Partial readElements(org.jdom2.Element root) {
    JodaTimeUtil timeUtil = JodaTimeUtil.getInstance();
    Element TimeZoneElement = root.getChild("TimeZone");
    Element ChronologyElement = root.getChild("Chronology");
    Chronology myChronology = timeUtil.getChronologyForString(ChronologyElement.getTextNormalize(),
            TimeZoneElement.getTextNormalize());
    Element FieldsElement = root.getChild("Fields");
    List<Element> FieldsChildren = FieldsElement.getChildren();
    List<DateTimeFieldType> fieldTypes = new java.util.ArrayList<>(FieldsChildren.size());
    List<Integer> values = new java.util.ArrayList<>(FieldsChildren.size());
    for (Element curKeyValue : FieldsChildren) {
        Element KeyElement = curKeyValue.getChild("Key");
        Element ValueElement = curKeyValue.getChild("Value");
        fieldTypes.add(timeUtil.getDateTimeFieldTypeForString(KeyElement.getTextNormalize()));
        values.add(Integer.parseInt(ValueElement.getTextNormalize()));
    }/*from w ww.  j a va  2s  .  c  o  m*/
    int intValues[] = new int[values.size()];
    int i = 0;
    for (Integer curValue : values) {
        intValues[i] = curValue;
        i++;
    }
    return new Partial(fieldTypes.toArray(new DateTimeFieldType[fieldTypes.size()]), intValues, myChronology);
}