/**
  * Obtains an instance defining a transition between two offsets.
  *
  * <p>Applications should normally obtain an instance from {@link ZoneRules}. This constructor is
  * intended for use by implementors of {@code ZoneRules}.
  *
  * @param transition the transition date-time with the offset before the transition, not null
  * @param offsetAfter the offset at and after the transition, not null
  */
 public static ZoneOffsetTransition of(OffsetDateTime transition, ZoneOffset offsetAfter) {
   DateTimes.checkNotNull(transition, "OffsetDateTime must not be null");
   DateTimes.checkNotNull(transition, "ZoneOffset must not be null");
   if (transition.getOffset().equals(offsetAfter)) {
     throw new IllegalArgumentException("Offsets must not be equal");
   }
   return new ZoneOffsetTransition(transition, offsetAfter);
 }
示例#2
0
 /**
  * Compares this day-of-month instance to another.
  *
  * @param otherDayOfMonth the other day-of-month instance, not null
  * @return the comparator value, negative if less, positive if greater
  * @throws NullPointerException if otherDayOfMonth is null
  */
 public int compareTo(DayOfMonth otherDayOfMonth) {
   return DateTimes.safeCompare(dayOfMonth, otherDayOfMonth.dayOfMonth);
 }
示例#3
0
 /**
  * Checks if the specified year is a leap year.
  *
  * <p>ISO leap years occur exactly in line with ISO leap years. This method does not validate the
  * year passed in, and only has a well-defined result for years in the supported range.
  *
  * @param prolepticYear the proleptic-year to check, not validated for range
  * @return true if the year is a leap year
  */
 @Override
 public boolean isLeapYear(long prolepticYear) {
   return DateTimes.isLeapYear(prolepticYear);
 }