Example usage for org.joda.time Weeks parseWeeks

List of usage examples for org.joda.time Weeks parseWeeks

Introduction

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

Prototype

@FromString
public static Weeks parseWeeks(String periodStr) 

Source Link

Document

Creates a new Weeks by parsing a string in the ISO8601 format 'PnW'.

Usage

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

License:Apache License

private void handleAsString(String str) {
    if (isBlank(str)) {
        super.setValueInternal(null);
        return;/*from w  w w.  j ava 2 s  . c o m*/
    }

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

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