/** * Creates a time period representing a single year. * * @param year the year. */ public Year(int year) { if ((year < Year.MINIMUM_YEAR) || (year > Year.MAXIMUM_YEAR)) { throw new IllegalArgumentException( "Year constructor: year (" + year + ") outside valid range."); } this.year = (short) year; peg(Calendar.getInstance()); }
/** * Creates a time period representing a single year. * * @param year the year. */ public Year(int year) { if ((year < Year.MINIMUM_YEAR) || (year > Year.MAXIMUM_YEAR)) { throw new IllegalArgumentException( "Year constructor: year (" + year + ") outside valid range."); } this.year = (short) year; peg(Calendar.getInstance()); }
/** * Creates a new {@code Year} instance, for the specified time zone * and locale. * * @param time the current time ({@code null} not permitted). * @param zone the time zone. * @param locale the locale. * * @since 1.0.12 */ public Year(Date time, TimeZone zone, Locale locale) { Calendar calendar = Calendar.getInstance(zone, locale); calendar.setTime(time); this.year = (short) calendar.get(Calendar.YEAR); peg(calendar); }
/** * Creates a new <code>Year</code> instance, for the specified time zone * and locale. * * @param time the current time (<code>null</code> not permitted). * @param zone the time zone. * @param locale the locale. * * @since 1.0.12 */ public Year(Date time, TimeZone zone, Locale locale) { Calendar calendar = Calendar.getInstance(zone, locale); calendar.setTime(time); this.year = (short) calendar.get(Calendar.YEAR); peg(calendar); }