Example usage for org.joda.time Years parseYears

List of usage examples for org.joda.time Years parseYears

Introduction

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

Prototype

@FromString
public static Years parseYears(String periodStr) 

Source Link

Document

Creates a new Years by parsing a string in the ISO8601 format 'PnY'.

Usage

From source file:griffon.plugins.jodatime.editors.YearsPropertyEditor.java

License:Apache License

private void handleAsString(String str) {
    if (isBlank(str)) {
        super.setValueInternal(null);
        return;//from ww  w . j a  va 2  s. co m
    }

    try {
        super.setValueInternal(parse(Integer.parseInt(str)));
        return;
    } catch (NumberFormatException nfe) {
        // ignore
    }

    try {
        super.setValueInternal(Years.parseYears(str));
    } catch (IllegalArgumentException e) {
        throw illegalValue(str, Years.class, e);
    }
}