Class GeneratedResources
java.lang.Object
org.springframework.aot.generate.GeneratedResources
A managed collection of generated resources.
This class is stateful, so the same instance should be used for all resource generation.
- Since:
- 7.1
- Author:
- Stephane Nicoll
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionaddForFeature(String extension, String featureName) Add a new generated resource for the specifiedextensionandfeatureName, and no particular component.addForFeatureComponent(String extension, String featureName, org.springframework.javapoet.ClassName targetComponent) Add a new generated resource for the specifiedextensionandfeatureName, targeting the specifiedtargetComponent.Return theGeneratedResourceat the givenpath.getOrAddForFeature(String extension, String featureName) Get or add a generated resource for the specifiedextensionandfeatureName, and no particular component.getOrAddForFeatureComponent(String extension, String featureName, org.springframework.javapoet.ClassName targetComponent) Get or add a generated resource for the specifiedextensionandfeatureName, targeting the specifiedtargetComponent.
-
Method Details
-
getOrAdd
Return theGeneratedResourceat the givenpath.A valid
pathis an absolute location on the classpath with directories separated with/, and without a leading slash. For instancecom/example/my-resource.txt.- Parameters:
path- the absolute path of the resource on the classpath- Returns:
- a generated resource
-
getOrAddForFeature
Get or add a generated resource for the specifiedextensionandfeatureName, and no particular component. If this method has previously been called with the givenextension/featureNamethe existing resource will be returned, otherwise a new resource will be generated.- Parameters:
extension- the file extensionfeatureName- the name of the feature to associate with the generated resource- Returns:
- an existing or newly generated resource
-
getOrAddForFeatureComponent
public GeneratedResource getOrAddForFeatureComponent(String extension, String featureName, org.springframework.javapoet.ClassName targetComponent) Get or add a generated resource for the specifiedextensionandfeatureName, targeting the specifiedtargetComponent. If this method has previously been called with the givenextension/featureName/targetComponentthe existing resource will be returned, otherwise a new resource will be generated.- Parameters:
extension- the file extensionfeatureName- the name of the feature to associate with the generated resourcetargetComponent- the target component- Returns:
- an existing or newly generated resource
-
addForFeature
Add a new generated resource for the specifiedextensionandfeatureName, and no particular component.- Parameters:
extension- the file extensionfeatureName- the name of the feature to associate with the generated resource- Returns:
- the newly generated resource
-
addForFeatureComponent
public GeneratedResource addForFeatureComponent(String extension, String featureName, org.springframework.javapoet.ClassName targetComponent) Add a new generated resource for the specifiedextensionandfeatureName, targeting the specifiedtargetComponent.- Parameters:
extension- the file extensionfeatureName- the name of the feature to associate with the generated resourcetargetComponent- the target component- Returns:
- the newly generated resource
-