Package org.springframework.aot.hint

# Class ResourceHints

java.lang.Object
org.springframework.aot.hint.ResourceHints

public class ResourceHints extends Object
Gather the need for resources available at runtime.

Since:
  6.0
Author:
  Stephane Nicoll, Sam Brannen

## Constructor Summary

Constructors
Constructor
Description
`ResourceHints()`

## Method Summary

Modifier and Type
Method
Description
`ResourceHints`
`registerPattern(String include)`
Register that the resources matching the specified pattern should be made available at runtime.
`ResourceHints`
`registerPattern(Consumer<ResourcePatternHints.Builder> resourceHint)`
Register that the resources matching the specified pattern should be made available at runtime.
`ResourceHints`
`registerPatternIfPresent(ClassLoader classLoader, String location, Consumer<ResourcePatternHints.Builder> resourceHint)`
Register a pattern if the given `location` is available on the classpath.
`void`
`registerResource(Resource resource)`
Register that the supplied resource should be made available at runtime.
`ResourceHints`
`registerResourceBundle(String baseName)`
Register that the resource bundle with the specified base name should be made available at runtime.
`ResourceHints`
`registerResourceBundle(String baseName, Consumer<ResourceBundleHint.Builder> resourceHint)`
Register that the resource bundle with the specified base name should be made available at runtime.
`ResourceHints`
`registerType(Class<?> type)`
Register that the bytecode of the specified type should be made available at runtime.
`ResourceHints`
`registerType(TypeReference type)`
Register that the bytecode of the type defined by the specified `TypeReference` should be made available at runtime.
`Stream<ResourceBundleHint>`
`resourceBundleHints()`
Return the resource bundles that should be made available at runtime.
`Stream<ResourcePatternHints>`
`resourcePatternHints()`
Return the resources that should be made available at runtime.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### ResourceHints

public ResourceHints()

## Method Details

### resourcePatternHints

public Stream<ResourcePatternHints> resourcePatternHints()
Return the resources that should be made available at runtime.

Returns:
  a stream of `ResourcePatternHints`

### resourceBundleHints

public Stream<ResourceBundleHint> resourceBundleHints()
Return the resource bundles that should be made available at runtime.

Returns:
  a stream of `ResourceBundleHint`

### registerPatternIfPresent

public ResourceHints registerPatternIfPresent(@Nullable ClassLoader classLoader, String location, Consumer<ResourcePatternHints.Builder> resourceHint)
Register a pattern if the given `location` is available on the classpath. This delegates to `ClassLoader.getResource(String)` which validates directories as well. The location is not included in the hint.

Parameters:
  `classLoader` - the ClassLoader to use, or `null` for the default
  `location` - a '/'-separated path name that should exist
  `resourceHint` - a builder to customize the resource pattern
Returns:
  `this`, to facilitate method chaining

### registerPattern

public ResourceHints registerPattern(@Nullable Consumer<ResourcePatternHints.Builder> resourceHint)
Register that the resources matching the specified pattern should be made available at runtime.

Parameters:
  `resourceHint` - a builder to further customize the resource pattern
Returns:
  `this`, to facilitate method chaining

### registerPattern

public ResourceHints registerPattern(String include)
Register that the resources matching the specified pattern should be made available at runtime.

Parameters:
  `include` - a pattern of the resources to include (see `ResourcePatternHint` documentation)
Returns:
  `this`, to facilitate method chaining

### registerResource

public void registerResource(Resource resource)
Register that the supplied resource should be made available at runtime.

Parameters:
  `resource` - the resource to register
Throws:
  `IllegalArgumentException` - if the supplied resource is not a `ClassPathResource` or does not exist
See Also:
  - `registerPattern(String)`
  - `ClassPathResource.getPath()`

### registerType

public ResourceHints registerType(TypeReference type)
Register that the bytecode of the type defined by the specified `TypeReference` should be made available at runtime.

Parameters:
  `type` - the type to include
Returns:
  `this`, to facilitate method chaining

### registerType

public ResourceHints registerType(Class<?> type)
Register that the bytecode of the specified type should be made available at runtime.

Parameters:
  `type` - the type to include
Returns:
  `this`, to facilitate method chaining

### registerResourceBundle

public ResourceHints registerResourceBundle(String baseName, @Nullable Consumer<ResourceBundleHint.Builder> resourceHint)
Register that the resource bundle with the specified base name should be made available at runtime.

Parameters:
  `baseName` - the base name of the resource bundle
  `resourceHint` - a builder to further customize the resource bundle
Returns:
  `this`, to facilitate method chaining

### registerResourceBundle

public ResourceHints registerResourceBundle(String baseName)
Register that the resource bundle with the specified base name should be made available at runtime.

Parameters:
  `baseName` - the base name of the resource bundle
Returns:
  `this`, to facilitate method chaining