Home / Function/ toInstant() — spring-boot Function Reference

toInstant() — spring-boot Function Reference

Architecture documentation for the toInstant() function in MavenBuildOutputTimestamp.java from the spring-boot codebase.

Entity Profile

Dependency Diagram

graph TD
  f581f759_6b98_4273_b1dd_34f7abc3ba92["toInstant()"]
  3fc3df8f_f581_7898_5141_15f4b8a3bc52["toFileTime()"]
  3fc3df8f_f581_7898_5141_15f4b8a3bc52 -->|calls| f581f759_6b98_4273_b1dd_34f7abc3ba92
  d7983c80_3ac9_31ba_0893_b250531267f7["isNumeric()"]
  f581f759_6b98_4273_b1dd_34f7abc3ba92 -->|calls| d7983c80_3ac9_31ba_0893_b250531267f7
  style f581f759_6b98_4273_b1dd_34f7abc3ba92 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/MavenBuildOutputTimestamp.java lines 79–100

	@Nullable Instant toInstant() {
		if (!StringUtils.hasLength(this.timestamp)) {
			return null;
		}
		if (isNumeric(this.timestamp)) {
			return Instant.ofEpochSecond(Long.parseLong(this.timestamp));
		}
		if (this.timestamp.length() < 2) {
			return null;
		}
		try {
			Instant instant = OffsetDateTime.parse(this.timestamp).withOffsetSameInstant(ZoneOffset.UTC).toInstant();
			if (instant.isBefore(DATE_MIN) || instant.isAfter(DATE_MAX)) {
				throw new IllegalArgumentException(
						String.format("'%s' is not within the valid range %s to %s", instant, DATE_MIN, DATE_MAX));
			}
			return instant;
		}
		catch (DateTimeParseException pe) {
			throw new IllegalArgumentException(String.format("Can't parse '%s' to instant", this.timestamp));
		}
	}

Domain

Subdomains

Calls

  • isNumeric()

Called By

  • toFileTime()

Frequently Asked Questions

What does toInstant() do?
toInstant() is a function in the spring-boot codebase.
What does toInstant() call?
toInstant() calls 1 function(s): isNumeric.
What calls toInstant()?
toInstant() is called by 1 function(s): toFileTime.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free