@Test public void testParseYear() { Year year = Year.parseYear("2000"); assertEquals(2000, year.getYear()); year = Year.parseYear(" 2001 "); assertEquals(2001, year.getYear()); year = Year.parseYear("99"); assertEquals(99, year.getYear()); }
public static Year parseYear(String s) { int y; try { y = Integer.parseInt(s.trim()); } catch (NumberFormatException e) { throw new TimePeriodFormatException("Cannot parse string."); } try { return new Year(y); } catch (IllegalArgumentException e) { throw new TimePeriodFormatException("Year outside valid range."); } }
Year extends RegularTimePeriod implements Serializable { public static Year parseYear(String s) { int y; try { y = Integer.parseInt(s.trim()); } catch (NumberFormatException e) { throw new TimePeriodFormatException("Cannot parse string."); } try { return new Year(y); } catch (IllegalArgumentException e) { throw new TimePeriodFormatException("Year outside valid range."); } } }
Year extends RegularTimePeriod implements Serializable { public static Year parseYear(String s) { int y; try { y = Integer.parseInt(s.trim()); } catch (NumberFormatException e) { throw new TimePeriodFormatException("Cannot parse string."); } try { return new Year(y); } catch (IllegalArgumentException e) { throw new TimePeriodFormatException("Year outside valid range."); } } Year();  Year(int year);  Year(Date time);  Year(Date time, TimeZone zone, Locale locale); }
Year extends RegularTimePeriod implements Serializable { public static Year parseYear(String s) { int y; try { y = Integer.parseInt(s.trim()); } catch (NumberFormatException e) { throw new TimePeriodFormatException("Cannot parse string."); } try { return new Year(y); } catch (IllegalArgumentException e) { throw new TimePeriodFormatException("Year outside valid range."); } } Year();  Year(int year);  Year(Date time);  Year(Date time, TimeZone zone, Locale locale); int getYear(); @Override long getFirstMillisecond(); @Override long getLastMillisecond(); @Override void peg(Calendar calendar); @Override RegularTimePeriod previous(); @Override RegularTimePeriod next(); @Override long getSerialIndex(); @Override long getFirstMillisecond(Calendar calendar); @Override long getLastMillisecond(Calendar calendar); @Override boolean equals(Object obj); @Override int hashCode(); @Override int compareTo(TimePeriod o1); @Override String toString(); static Year parseYear(String s); }
Year extends RegularTimePeriod implements Serializable { public static Year parseYear(String s) { int y; try { y = Integer.parseInt(s.trim()); } catch (NumberFormatException e) { throw new TimePeriodFormatException("Cannot parse string."); } try { return new Year(y); } catch (IllegalArgumentException e) { throw new TimePeriodFormatException("Year outside valid range."); } } Year();  Year(int year);  Year(Date time);  Year(Date time, TimeZone zone, Locale locale); int getYear(); @Override long getFirstMillisecond(); @Override long getLastMillisecond(); @Override void peg(Calendar calendar); @Override RegularTimePeriod previous(); @Override RegularTimePeriod next(); @Override long getSerialIndex(); @Override long getFirstMillisecond(Calendar calendar); @Override long getLastMillisecond(Calendar calendar); @Override boolean equals(Object obj); @Override int hashCode(); @Override int compareTo(TimePeriod o1); @Override String toString(); static Year parseYear(String s); static final int MINIMUM_YEAR; static final int MAXIMUM_YEAR; }