Example usage for org.joda.time.base BaseSingleFieldPeriod get

List of usage examples for org.joda.time.base BaseSingleFieldPeriod get

Introduction

In this page you can find the example usage for org.joda.time.base BaseSingleFieldPeriod get.

Prototype

public int get(DurationFieldType type) 

Source Link

Document

Gets the value of a duration field represented by this period.

Usage

From source file:com.trenako.utility.PeriodUtils.java

License:Apache License

private static Pair<String, Integer> periodValue(BaseSingleFieldPeriod field) {
    String name = field.getPeriodType().getName().toLowerCase();
    int value = field.get(field.getFieldType());
    if (value > 1) {
        return new ImmutablePair<>("interval." + name + ".more.label", value);
    } else if (value > 0) {
        return new ImmutablePair<>("interval." + name + ".one.label", 1);
    }//from ww w.  j  a va  2s  .  com

    return null;
}