List of usage examples for org.joda.time Period withPeriodType
public Period withPeriodType(PeriodType type)
From source file:org.jadira.usertype.dateandtime.joda.columnmapper.StringColumnPeriodMapper.java
License:Apache License
@Override public Period fromNonNullValue(String s) { int separatorIndex = s.indexOf('{'); if (separatorIndex == -1) { return new Period(s); } else {/*w w w. j av a 2s. co m*/ Period period = new Period(s.substring(0, separatorIndex)); return period.withPeriodType(determinePeriodType(s.substring(separatorIndex + 1, s.length() - 1))); } }