Example usage for org.joda.time Hours parseHours

List of usage examples for org.joda.time Hours parseHours

Introduction

In this page you can find the example usage for org.joda.time Hours parseHours.

Prototype

@FromString
public static Hours parseHours(String periodStr) 

Source Link

Document

Creates a new Hours by parsing a string in the ISO8601 format 'PTnH'.

Usage

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

License:Apache License

private void handleAsString(String str) {
    if (isBlank(str)) {
        super.setValueInternal(null);
        return;/*from w ww  .  ja  v  a  2s  .  c  om*/
    }

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

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