Java Code Examples for java.time.temporal.ChronoUnit#FOREVER

The following examples show how to use java.time.temporal.ChronoUnit#FOREVER . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChronoConverterUtilsImpl.java    From IridiumApplicationTesting with MIT License 4 votes vote down vote up
@Override
public ChronoUnit fromString(@NotNull final String input) {
	checkArgument(StringUtils.isNotBlank(input));

	if ("Nanos".equalsIgnoreCase(input) || "Nano".equalsIgnoreCase(input)) {
		return ChronoUnit.NANOS;
	}

	if ("Micros".equalsIgnoreCase(input) || "Micro".equalsIgnoreCase(input)) {
		return ChronoUnit.MICROS;
	}

	if ("Millis".equalsIgnoreCase(input) || "Milli".equalsIgnoreCase(input)) {
		return ChronoUnit.MILLIS;
	}

	if ("Seconds".equalsIgnoreCase(input) || "Second".equalsIgnoreCase(input)) {
		return ChronoUnit.SECONDS;
	}

	if ("Minutes".equalsIgnoreCase(input) || "Minute".equalsIgnoreCase(input)) {
		return ChronoUnit.MINUTES;
	}

	if ("Hours".equalsIgnoreCase(input) || "Hour".equalsIgnoreCase(input)) {
		return ChronoUnit.HOURS;
	}

	if ("HalfDays".equalsIgnoreCase(input) || "HalfDay".equalsIgnoreCase(input)) {
		return ChronoUnit.HALF_DAYS;
	}

	if ("Days".equalsIgnoreCase(input) || "Day".equalsIgnoreCase(input)) {
		return ChronoUnit.DAYS;
	}

	if ("Weeks".equalsIgnoreCase(input) || "Week".equalsIgnoreCase(input)) {
		return ChronoUnit.WEEKS;
	}

	if ("Months".equalsIgnoreCase(input) || "Month".equalsIgnoreCase(input)) {
		return ChronoUnit.MONTHS;
	}

	if ("Years".equalsIgnoreCase(input) || "Year".equalsIgnoreCase(input)) {
		return ChronoUnit.YEARS;
	}

	if ("Decades".equalsIgnoreCase(input) || "Decade".equalsIgnoreCase(input)) {
		return ChronoUnit.DECADES;
	}

	if ("Centuries".equalsIgnoreCase(input) || "Century".equalsIgnoreCase(input)) {
		return ChronoUnit.CENTURIES;
	}

	if ("Millennia".equalsIgnoreCase(input)) {
		return ChronoUnit.MILLENNIA;
	}

	if ("Eras".equalsIgnoreCase(input) || "Era".equalsIgnoreCase(input)) {
		return ChronoUnit.ERAS;
	}

	if ("Forever".equalsIgnoreCase(input)) {
		return ChronoUnit.FOREVER;
	}

	throw new InvalidInputException(input + " is not a valid ChronoUnit");
}
 
Example 2
Source File: SecondsSinceMidnight.java    From jpmml-evaluator with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public TemporalUnit getRangeUnit(){
	return ChronoUnit.FOREVER;
}