Top Description Inners Fields Constructors Methods
org.springframework.aot.hint.support

public Class FilePatternResourceHintsRegistrar

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Arrays, .List, org.springframework.aot.hint.ResourceHints, org.springframework.lang.Nullable, org.springframework.util.Assert, .ResourceUtils

Register the necessary resource hints for loading files from the classpath, based on file name prefixes and file extensions with convenience to support multiple classpath locations.

Only registers hints for matching classpath locations, which allows for several locations to be provided without contributing unnecessary hints.

Authors
Stephane Nicoll, Sam Brannen
Since
6.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final List<String>
private final List<String>
private final List<String>

Constructor Summary

AccessConstructor and Description
public
FilePatternResourceHintsRegistrar(List<String>
the file prefixes
filePrefixes
,
List<String>
the classpath locations
classpathLocations
,
List<String>
the file extensions (starting with a dot)
fileExtensions
)
Deprecated for removal since 6.0.12. as of 6.0.12 in favor of the builder

Create a new instance for the specified file prefixes, classpath locations, and file extensions.

Method Summary

Modifier and TypeMethod and Description
public static FilePatternResourceHintsRegistrar.Builder

Returns:

a Builder to further configure the registrar
forClassPathLocations
(String...
the classpath locations
classpathLocations
)

Configure the registrar with the specified classpath locations.

public static FilePatternResourceHintsRegistrar.Builder

Returns:

a Builder to further configure the registrar
forClassPathLocations
(List<String>
the classpath locations
classpathLocations
)

Configure the registrar with the specified classpath locations.

public void
registerHints(ResourceHints hints, ClassLoader classLoader)
Deprecated for removal since 6.0.12.

private static List<String>
validateClasspathLocations(List<String> classpathLocations)

private static List<String>
private static List<String>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

classpathLocationsback to summary
private final List<String> classpathLocations
fileExtensionsback to summary
private final List<String> fileExtensions
filePrefixesback to summary
private final List<String> filePrefixes

Constructor Detail

FilePatternResourceHintsRegistrarback to summary
public FilePatternResourceHintsRegistrar(List<String> filePrefixes, List<String> classpathLocations, List<String> fileExtensions)

Deprecated

for removal since 6.0.12.

as of 6.0.12 in favor of the builder

Create a new instance for the specified file prefixes, classpath locations, and file extensions.

Parameters
filePrefixes:List<String>

the file prefixes

classpathLocations:List<String>

the classpath locations

fileExtensions:List<String>

the file extensions (starting with a dot)

Annotations
@Deprecated
since:6.0.12
forRemoval:true

Method Detail

forClassPathLocationsback to summary
public static FilePatternResourceHintsRegistrar.Builder forClassPathLocations(String... classpathLocations)

Configure the registrar with the specified classpath locations.

Parameters
classpathLocations:String[]

the classpath locations

Returns:FilePatternResourceHintsRegistrar.Builder

a Builder to further configure the registrar

Since
6.0.12
See Also
forClassPathLocations(List)
forClassPathLocationsback to summary
public static FilePatternResourceHintsRegistrar.Builder forClassPathLocations(List<String> classpathLocations)

Configure the registrar with the specified classpath locations.

Parameters
classpathLocations:List<String>

the classpath locations

Returns:FilePatternResourceHintsRegistrar.Builder

a Builder to further configure the registrar

Since
6.0.12
See Also
forClassPathLocations(String...)
registerHintsback to summary
public void registerHints(ResourceHints hints, ClassLoader classLoader)

Deprecated

for removal since 6.0.12.

Annotations
@Deprecated
since:6.0.12
forRemoval:true
validateClasspathLocationsback to summary
private static List<String> validateClasspathLocations(List<String> classpathLocations)
validateFileExtensionsback to summary
private static List<String> validateFileExtensions(List<String> fileExtensions)
validateFilePrefixesback to summary
private static List<String> validateFilePrefixes(List<String> filePrefixes)
org.springframework.aot.hint.support back to summary

public final Class FilePatternResourceHintsRegistrar.Builder

extends Object
Class Inheritance
  • java.lang.Object
  • org.springframework.aot.hint.support.FilePatternResourceHintsRegistrar.Builder

Builder for FilePatternResourceHintsRegistrar.
Since
6.0.12

Field Summary

Modifier and TypeField and Description
private final List<String>
private final List<String>
private final List<String>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private FilePatternResourceHintsRegistrar
public void
registerHints(ResourceHints
the hints contributed so far for the deployment unit
hints
,
ClassLoader
the classloader, or null if even the system ClassLoader isn't accessible
classLoader
)

Register resource hints for the current state of this builder.

public FilePatternResourceHintsRegistrar.Builder

Returns:

this builder
withClasspathLocations
(String...
the classpath locations to consider
classpathLocations
)

Consider the specified classpath locations.

public FilePatternResourceHintsRegistrar.Builder

Returns:

this builder
withClasspathLocations
(List<String>
the classpath locations to consider
classpathLocations
)

Consider the specified classpath locations.

public FilePatternResourceHintsRegistrar.Builder

Returns:

this builder
withFileExtensions
(String...
the file extensions to consider
fileExtensions
)

Consider the specified file extensions.

public FilePatternResourceHintsRegistrar.Builder

Returns:

this builder
withFileExtensions
(List<String>
the file extensions to consider
fileExtensions
)

Consider the specified file extensions.

public FilePatternResourceHintsRegistrar.Builder

Returns:

this builder
withFilePrefixes
(String...
the file prefixes to consider
filePrefixes
)

Consider the specified file prefixes.

public FilePatternResourceHintsRegistrar.Builder

Returns:

this builder
withFilePrefixes
(List<String>
the file prefixes to consider
filePrefixes
)

Consider the specified file prefixes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

classpathLocationsback to summary
private final List<String> classpathLocations
fileExtensionsback to summary
private final List<String> fileExtensions
filePrefixesback to summary
private final List<String> filePrefixes

Constructor Detail

Builderback to summary
private Builder()

Method Detail

buildback to summary
private FilePatternResourceHintsRegistrar build()
registerHintsback to summary
public void registerHints(ResourceHints hints, ClassLoader classLoader)

Register resource hints for the current state of this builder. For each classpath location that resolves against the ClassLoader, files with the configured file prefixes and extensions are registered.

Parameters
hints:ResourceHints

the hints contributed so far for the deployment unit

classLoader:ClassLoader

the classloader, or null if even the system ClassLoader isn't accessible

withClasspathLocationsback to summary
public FilePatternResourceHintsRegistrar.Builder withClasspathLocations(String... classpathLocations)

Consider the specified classpath locations.

A location can either be a special classpath: pseudo location or a standard location, such as com/example/resources. An empty String represents the root of the classpath.

Parameters
classpathLocations:String[]

the classpath locations to consider

Returns:FilePatternResourceHintsRegistrar.Builder

this builder

See Also
withClasspathLocations(List)
withClasspathLocationsback to summary
public FilePatternResourceHintsRegistrar.Builder withClasspathLocations(List<String> classpathLocations)

Consider the specified classpath locations.

A location can either be a special classpath: pseudo location or a standard location, such as com/example/resources. An empty String represents the root of the classpath.

Parameters
classpathLocations:List<String>

the classpath locations to consider

Returns:FilePatternResourceHintsRegistrar.Builder

this builder

See Also
withClasspathLocations(String...)
withFileExtensionsback to summary
public FilePatternResourceHintsRegistrar.Builder withFileExtensions(String... fileExtensions)

Consider the specified file extensions. A file extension must start with a . character.

Parameters
fileExtensions:String[]

the file extensions to consider

Returns:FilePatternResourceHintsRegistrar.Builder

this builder

See Also
withFileExtensions(List)
withFileExtensionsback to summary
public FilePatternResourceHintsRegistrar.Builder withFileExtensions(List<String> fileExtensions)

Consider the specified file extensions. A file extension must start with a . character.

Parameters
fileExtensions:List<String>

the file extensions to consider

Returns:FilePatternResourceHintsRegistrar.Builder

this builder

See Also
withFileExtensions(String...)
withFilePrefixesback to summary
public FilePatternResourceHintsRegistrar.Builder withFilePrefixes(String... filePrefixes)

Consider the specified file prefixes. Any file whose name starts with one of the specified prefixes is considered. A prefix cannot contain the * character.

Parameters
filePrefixes:String[]

the file prefixes to consider

Returns:FilePatternResourceHintsRegistrar.Builder

this builder

See Also
withFilePrefixes(List)
withFilePrefixesback to summary
public FilePatternResourceHintsRegistrar.Builder withFilePrefixes(List<String> filePrefixes)

Consider the specified file prefixes. Any file whose name starts with one of the specified prefixes is considered. A prefix cannot contain the * character.

Parameters
filePrefixes:List<String>

the file prefixes to consider

Returns:FilePatternResourceHintsRegistrar.Builder

this builder

See Also
withFilePrefixes(String...)