Class GeneratedResources

java.lang.Object
org.springframework.aot.generate.GeneratedResources

public class GeneratedResources extends Object
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 Details

    • getOrAdd

      public GeneratedResource getOrAdd(String path)
      Return the GeneratedResource at the given path.

      A valid path is an absolute location on the classpath with directories separated with /, and without a leading slash. For instance com/example/my-resource.txt.

      Parameters:
      path - the absolute path of the resource on the classpath
      Returns:
      a generated resource
    • getOrAddForFeature

      public GeneratedResource getOrAddForFeature(String extension, String featureName)
      Get or add a generated resource for the specified extension and featureName, and no particular component. If this method has previously been called with the given extension/featureName the existing resource will be returned, otherwise a new resource will be generated.
      Parameters:
      extension - the file extension
      featureName - 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 specified extension and featureName, targeting the specified targetComponent. If this method has previously been called with the given extension/featureName/targetComponent the existing resource will be returned, otherwise a new resource will be generated.
      Parameters:
      extension - the file extension
      featureName - the name of the feature to associate with the generated resource
      targetComponent - the target component
      Returns:
      an existing or newly generated resource
    • addForFeature

      public GeneratedResource addForFeature(String extension, String featureName)
      Add a new generated resource for the specified extension and featureName, and no particular component.
      Parameters:
      extension - the file extension
      featureName - 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 specified extension and featureName, targeting the specified targetComponent.
      Parameters:
      extension - the file extension
      featureName - the name of the feature to associate with the generated resource
      targetComponent - the target component
      Returns:
      the newly generated resource