Class JctFileManagerConfigurerChain
This is used to provide a set of ordered configuration operations to perform on newly created file managers to prepare them for consumption in test cases. Common operations may include:
- Automatically configuring the annotation processor paths;
- Creating empty locations to prevent compilers raising exceptions;
- Installing logging interceptors.
When configuring a file manager with this chain, each configurer is invoked in the provided order. Configurers themselves must return a file manager as a result of the configure operation. This operation may return the input file manager if the operation mutated the input, or it may return a different file manager instance. In the latter case, subsequent configuration operations internally will use the new file manager. The last returned file manager in the chain will be used as the final returned result. This enables configurers to wrap file managers in proxies or delegating implementations to intercept or override existing behaviours.
This class is not thread-safe.
- Since:
- 0.0.1
- Author:
- Ashley Scopes
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddFirst
(JctFileManagerConfigurer configurer) Add a configurer to the start of the chain.addLast
(JctFileManagerConfigurer configurer) Add a configurer to the end of the chain.configure
(JctFileManager fileManager) Apply each configurer to the given file manager in order.list()
Get an immutable copy of the list of configurers.
-
Constructor Details
-
JctFileManagerConfigurerChain
public JctFileManagerConfigurerChain()Initialise this chain.
-
-
Method Details
-
addFirst
Add a configurer to the start of the chain.- Parameters:
configurer
- the configurer to add.- Returns:
- this chain for further calls.
-
addLast
Add a configurer to the end of the chain.- Parameters:
configurer
- the configurer to add.- Returns:
- this chain for further calls.
-
list
Get an immutable copy of the list of configurers.- Returns:
- the list of configurers.
-
configure
Apply each configurer to the given file manager in order.- Parameters:
fileManager
- the file manager to configure.- Returns:
- the configured file manager to use. This may or may not be the same object as the input parameter, depending on how the configurers manipulate the input object.
-