Class GeneratedResource
java.lang.Object
org.springframework.aot.generate.GeneratedResource
A single generated resource.
- Since:
- 7.1
- Author:
- Stephane Nicoll
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAbstraction of the content of a generated resource. -
Method Summary
Modifier and TypeMethodDescriptiongetPath()Return the absolute path of this resource on the classpath.voidhandle(Consumer<GeneratedResource.Content> content) Handle this instance, using the providedGeneratedResource.Content.booleanWhether this instance has content associated to it.toString()
-
Method Details
-
getPath
Return the absolute path of this resource on the classpath.The path returned by this method does not have a leading slash and is suitable for generated code that use
ClassLoader.getResource(String).- Returns:
- the path of this resource on the classpath
- See Also:
-
hasContent
public boolean hasContent()Whether this instance has content associated to it. Instances that do not have content are not contributed toGeneratedFiles.- Returns:
trueif this instance has content- See Also:
-
handle
Handle this instance, using the providedGeneratedResource.Content.createonly allows a single attempt to create the content of a generated resource. If several rounds of AOT processing may touch the same unique path, usecreateOrValidateinstead, which creates the content on the first call and validates it against subsequent calls.- Parameters:
content- the content to use
-
toString
-