List of usage examples for org.joda.time Years parseYears
@FromString public static Years parseYears(String periodStr)
Years by parsing a string in the ISO8601 format 'PnY'. 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); } }