Example usage for org.joda.time Period getPeriodType

List of usage examples for org.joda.time Period getPeriodType

Introduction

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

Prototype

public PeriodType getPeriodType() 

Source Link

Document

Gets the period type.

Usage

From source file:org.jadira.usertype.dateandtime.joda.columnmapper.StringColumnPeriodMapper.java

License:Apache License

@Override
public String toNonNullValue(Period value) {

    final String periodString;
    if (STANDARD.equals(value.getPeriodType())) {
        periodString = value.toString();
    } else {//ww w  .j ava2s.c om
        if (PeriodType.class.equals(value.getPeriodType().getClass())) {
            periodString = value.toString() + "{" + value.getPeriodType().getName() + "}";
        } else {

            throw new IllegalArgumentException("Subclasses of PeriodType are unsupported");
        }
    }
    return periodString;
}