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

forJarFile() — spring-boot Function Reference

Architecture documentation for the forJarFile() function in ImageReference.java from the spring-boot codebase.

Entity Profile

Dependency Diagram

graph TD
  d0267968_c6b0_94c7_0893_993621d15553["forJarFile()"]
  b3171812_ab1f_87c4_a83a_2a91e929e461["getName()"]
  d0267968_c6b0_94c7_0893_993621d15553 -->|calls| b3171812_ab1f_87c4_a83a_2a91e929e461
  56c6a94a_906f_bea5_18c0_207cf050ae68["of()"]
  d0267968_c6b0_94c7_0893_993621d15553 -->|calls| 56c6a94a_906f_bea5_18c0_207cf050ae68
  style d0267968_c6b0_94c7_0893_993621d15553 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/type/ImageReference.java lines 190–208

	public static ImageReference forJarFile(File jarFile) {
		Assert.notNull(jarFile, "'jarFile' must not be null");
		String filename = jarFile.getName();
		Assert.isTrue(filename.toLowerCase(Locale.ROOT).endsWith(".jar"),
				() -> "'jarFile' must end with '.jar' [" + jarFile + "]");
		filename = filename.substring(0, filename.length() - 4);
		int firstDot = filename.indexOf('.');
		if (firstDot == -1) {
			return of(filename);
		}
		String name = filename.substring(0, firstDot);
		String version = filename.substring(firstDot + 1);
		Matcher matcher = JAR_VERSION_PATTERN.matcher(name);
		if (matcher.matches()) {
			name = matcher.group(1);
			version = matcher.group(2).substring(1) + "." + version;
		}
		return of(ImageName.of(name), version);
	}

Subdomains

Frequently Asked Questions

What does forJarFile() do?
forJarFile() is a function in the spring-boot codebase.
What does forJarFile() call?
forJarFile() calls 2 function(s): getName, of.

Analyze Your Own Codebase

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

Try Supermodel Free