/**
  * Checks if the identifier is valid on the specified date.
  *
  * @param date the date to check for validity on, null returns true
  * @return true if valid on the specified date
  */
 public boolean isValidOn(LocalDate date) {
   if (date == null) {
     return true;
   }
   LocalDate from =
       Objects.firstNonNull(
           getValidFrom(), LocalDate.of(Year.MIN_YEAR, 1, 1)); // TODO: JSR-310 far past/future
   LocalDate to = Objects.firstNonNull(getValidTo(), LocalDate.of(Year.MAX_YEAR, 12, 31));
   return date.isBefore(from) == false && date.isAfter(to) == false;
 }
 /**
  * Creates an instance.
  *
  * @param identifier the identifier, not null
  * @param validFrom the valid from date, may be null
  * @param validTo the valid to date, may be null
  */
 private ExternalIdWithDates(ExternalId identifier, LocalDate validFrom, LocalDate validTo) {
   ArgumentChecker.notNull(identifier, "identifier");
   if (validFrom != null && validTo != null) {
     ArgumentChecker.isTrue(
         validTo.isAfter(validFrom) || validTo.equals(validFrom),
         "ValidTo must be after or eqauls to ValidFrom");
   }
   _identifier = identifier;
   _validFrom = validFrom;
   _validTo = validTo;
 }