Module pro.verron.officestamper
Package pro.verron.officestamper.api
Interface OfficeStamperConfiguration
public interface OfficeStamperConfiguration
Interface representing the configuration for the Office Stamper functionality.
-
Method Summary
Modifier and TypeMethodDescriptionaddCommentProcessor
(Class<?> interfaceClass, Function<ParagraphPlaceholderReplacer, CommentProcessor> commentProcessorFactory) Adds a comment processor to the OfficeStamperConfiguration.addCustomFunction
(String name, Class<T> class0) Adds a custom function with the specified name and associated class type.<T,
U> CustomFunction.NeedsBiFunctionImpl <T, U> addCustomFunction
(String name, Class<T> class0, Class<U> class1) Adds a custom bi-function with the specified name and the provided parameter types.<T,
U, V> CustomFunction.NeedsTriFunctionImpl <T, U, V> addCustomFunction
(String name, Class<T> class0, Class<U> class1, Class<V> class2) Adds a custom function with the specified parameters.void
addCustomFunction
(String name, Supplier<?> implementation) Adds a custom function to the system with the specified name and implementation.void
addPostprocessor
(PostProcessor postProcessor) Adds a postprocessor to modify or enhance data or operations during the processing lifecycle.void
addPreprocessor
(PreProcessor preprocessor) Adds a pre-processor to the OfficeStamperConfiguration.addResolver
(ObjectResolver resolver) Adds an ObjectResolver to the OfficeStamperConfiguration.Retrieves a list of custom functions.exposeInterfaceToExpressionLanguage
(Class<?> interfaceClass, Object implementation) Exposes an interface to the expression language.Returns a map of comment processors associated with their respective classes.Retrieves the EvaluationContextConfigurer for configuring the Spring Expression Language (SPEL) EvaluationContext used by the docxstamper.Retrieves the instance of the ExceptionResolver.Retrieves the map of expression functions associated with their corresponding classes.Retrieves the line break placeholder used in the OfficeStamper configuration.Retrieves the list of post-processors associated with this instance.Retrieves the list of pre-processors.Retrieves the list of ObjectResolvers.org.springframework.expression.spel.SpelParserConfiguration
Retrieves the SpelParserConfiguration used by the OfficeStamperConfiguration.Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated because it offers limited functionality by just checking a flag.boolean
Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated because it offers limited functionality by just checking a flag.boolean
Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated because it offers limited functionality by just checking a flag.boolean
Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated because it offers limited functionality by just checking a flag.leaveEmptyOnExpressionError
(boolean leaveEmpty) Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated because it offers limited functionality by just checking a flag.replaceUnresolvedExpressions
(boolean replaceUnresolvedExpressions) Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated because it offers limited functionality by just checking a flag.setEvaluationContextConfigurer
(EvaluationContextConfigurer evaluationContextConfigurer) Sets the EvaluationContextConfigurer for configuring the Spring Expression Language (SPEL) EvaluationContext.setExceptionResolver
(ExceptionResolver exceptionResolver) Sets the exception resolver to be used by the OfficeStamperConfiguration.setFailOnUnresolvedExpression
(boolean failOnUnresolvedExpression) Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated because it offers limited functionality by just checking a flag.setLineBreakPlaceholder
(String lineBreakPlaceholder) Sets the line break placeholder used in the OfficeStamper configuration.setResolvers
(List<ObjectResolver> resolvers) Sets the list of object resolvers for the OfficeStamper configuration.setSpelParserConfiguration
(org.springframework.expression.spel.SpelParserConfiguration spelParserConfiguration) Sets the SpelParserConfiguration used by the OfficeStamperConfiguration.unresolvedExpressionsDefaultValue
(String unresolvedExpressionsDefaultValue) Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated because it offers limited functionality by just checking a flag.
-
Method Details
-
isFailOnUnresolvedExpression
Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated because it offers limited functionality by just checking a flag. It is replaced bysetExceptionResolver(ExceptionResolver)
, which provides complete customization over the behavior during resolution failures. The new method allows you to define how unresolved expressions are handled in a more flexible and comprehensive manner.Checks if the failOnUnresolvedExpression flag is set to true or false.- Returns:
- true if failOnUnresolvedExpression is set to true, false otherwise.
-
setFailOnUnresolvedExpression
@Deprecated(since="2.5", forRemoval=true) OfficeStamperConfiguration setFailOnUnresolvedExpression(boolean failOnUnresolvedExpression) Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated because it offers limited functionality by just checking a flag. It is replaced bysetExceptionResolver(ExceptionResolver)
, which provides complete customization over the behavior during resolution failures. The new method allows you to define how unresolved expressions are handled in a more flexible and comprehensive manner.Sets the failOnUnresolvedExpression flag to determine whether unresolved expressions should cause an exception to be thrown.- Parameters:
failOnUnresolvedExpression
- flag indicating whether to fail on unresolved expressions- Returns:
- the updated OfficeStamperConfiguration object
-
isLeaveEmptyOnExpressionError
Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated because it offers limited functionality by just checking a flag. It is replaced bysetExceptionResolver(ExceptionResolver)
, which provides complete customization over the behavior during resolution failures. The new method allows you to define how unresolved expressions are handled in a more flexible and comprehensive manner.Determines whether to leave empty on expression error.- Returns:
- true if expression errors are left empty, false otherwise
-
isReplaceUnresolvedExpressions
Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated because it offers limited functionality by just checking a flag. It is replaced bysetExceptionResolver(ExceptionResolver)
, which provides complete customization over the behavior during resolution failures. The new method allows you to define how unresolved expressions are handled in a more flexible and comprehensive manner.Determines whether unresolved expressions in the OfficeStamper configuration should be replaced.- Returns:
- true if unresolved expressions should be replaced, false otherwise.
-
getUnresolvedExpressionsDefaultValue
Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated because it offers limited functionality by just checking a flag. It is replaced bysetExceptionResolver(ExceptionResolver)
, which provides complete customization over the behavior during resolution failures. The new method allows you to define how unresolved expressions are handled in a more flexible and comprehensive manner.Retrieves the default value for unresolved expressions.- Returns:
- the default value for unresolved expressions
-
unresolvedExpressionsDefaultValue
@Deprecated(since="2.5", forRemoval=true) OfficeStamperConfiguration unresolvedExpressionsDefaultValue(String unresolvedExpressionsDefaultValue) Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated because it offers limited functionality by just checking a flag. It is replaced bysetExceptionResolver(ExceptionResolver)
, which provides complete customization over the behavior during resolution failures. The new method allows you to define how unresolved expressions are handled in a more flexible and comprehensive manner.Sets the default value for unresolved expressions in the OfficeStamperConfiguration object.- Parameters:
unresolvedExpressionsDefaultValue
- the default value for unresolved expressions- Returns:
- the updated OfficeStamperConfiguration object
-
replaceUnresolvedExpressions
@Deprecated(since="2.5", forRemoval=true) OfficeStamperConfiguration replaceUnresolvedExpressions(boolean replaceUnresolvedExpressions) Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated because it offers limited functionality by just checking a flag. It is replaced bysetExceptionResolver(ExceptionResolver)
, which provides complete customization over the behavior during resolution failures. The new method allows you to define how unresolved expressions are handled in a more flexible and comprehensive manner.Replaces unresolved expressions in the OfficeStamperConfiguration object.- Parameters:
replaceUnresolvedExpressions
- flag indicating whether to replace unresolved expressions- Returns:
- the updated OfficeStamperConfiguration object
-
leaveEmptyOnExpressionError
@Deprecated(since="2.5", forRemoval=true) OfficeStamperConfiguration leaveEmptyOnExpressionError(boolean leaveEmpty) Deprecated, for removal: This API element is subject to removal in a future version.This method is deprecated because it offers limited functionality by just checking a flag. It is replaced bysetExceptionResolver(ExceptionResolver)
, which provides complete customization over the behavior during resolution failures. The new method allows you to define how unresolved expressions are handled in a more flexible and comprehensive manner.Configures whether to leave empty on expression error.- Parameters:
leaveEmpty
- boolean value indicating whether to leave empty on expression error- Returns:
- the updated OfficeStamperConfiguration object
-
exposeInterfaceToExpressionLanguage
OfficeStamperConfiguration exposeInterfaceToExpressionLanguage(Class<?> interfaceClass, Object implementation) Exposes an interface to the expression language.- Parameters:
interfaceClass
- the interface class to be exposedimplementation
- the implementation object of the interface- Returns:
- the updated OfficeStamperConfiguration object
-
addCommentProcessor
OfficeStamperConfiguration addCommentProcessor(Class<?> interfaceClass, Function<ParagraphPlaceholderReplacer, CommentProcessor> commentProcessorFactory) Adds a comment processor to the OfficeStamperConfiguration. A comment processor is responsible for processing comments in the document and performing specific operations based on the comment content.- Parameters:
interfaceClass
- the interface class associated with the comment processorcommentProcessorFactory
- a function that creates a CommentProcessor object based on the ParagraphPlaceholderReplacer implementation- Returns:
- the updated OfficeStamperConfiguration object
-
addPreprocessor
Adds a pre-processor to the OfficeStamperConfiguration. A pre-processor is responsible for processing the document before the actual processing takes place.- Parameters:
preprocessor
- the pre-processor to add
-
getLineBreakPlaceholder
String getLineBreakPlaceholder()Retrieves the line break placeholder used in the OfficeStamper configuration.- Returns:
- the line break placeholder as a String.
-
setLineBreakPlaceholder
Sets the line break placeholder used in the OfficeStamper configuration.- Parameters:
lineBreakPlaceholder
- the line break placeholder as a String- Returns:
- the updated OfficeStamperConfiguration object
-
getEvaluationContextConfigurer
EvaluationContextConfigurer getEvaluationContextConfigurer()Retrieves the EvaluationContextConfigurer for configuring the Spring Expression Language (SPEL) EvaluationContext used by the docxstamper.- Returns:
- the EvaluationContextConfigurer for configuring the SPEL EvaluationContext.
-
setEvaluationContextConfigurer
OfficeStamperConfiguration setEvaluationContextConfigurer(EvaluationContextConfigurer evaluationContextConfigurer) Sets the EvaluationContextConfigurer for configuring the Spring Expression Language (SPEL) EvaluationContext.- Parameters:
evaluationContextConfigurer
- the EvaluationContextConfigurer for configuring the SPEL EvaluationContext. Must implement the evaluateEvaluationContext() method.- Returns:
- the updated OfficeStamperConfiguration object.
-
getSpelParserConfiguration
org.springframework.expression.spel.SpelParserConfiguration getSpelParserConfiguration()Retrieves the SpelParserConfiguration used by the OfficeStamperConfiguration.- Returns:
- the SpelParserConfiguration object used by the OfficeStamperConfiguration.
-
setSpelParserConfiguration
OfficeStamperConfiguration setSpelParserConfiguration(org.springframework.expression.spel.SpelParserConfiguration spelParserConfiguration) Sets the SpelParserConfiguration used by the OfficeStamperConfiguration.- Parameters:
spelParserConfiguration
- the SpelParserConfiguration to be set- Returns:
- the updated OfficeStamperConfiguration object
-
getExpressionFunctions
Retrieves the map of expression functions associated with their corresponding classes.- Returns:
- a map containing the expression functions as values and their corresponding classes as keys.
-
getCommentProcessors
Map<Class<?>,Function<ParagraphPlaceholderReplacer, getCommentProcessors()CommentProcessor>> Returns a map of comment processors associated with their respective classes.- Returns:
- The map of comment processors. The keys are the classes, and the values are the corresponding comment processors.
-
getPreprocessors
List<PreProcessor> getPreprocessors()Retrieves the list of pre-processors.- Returns:
- The list of pre-processors.
-
getResolvers
List<ObjectResolver> getResolvers()Retrieves the list of ObjectResolvers.- Returns:
- The list of ObjectResolvers.
-
setResolvers
Sets the list of object resolvers for the OfficeStamper configuration.- Parameters:
resolvers
- the list of object resolvers to be set- Returns:
- the updated OfficeStamperConfiguration instance
-
addResolver
Adds an ObjectResolver to the OfficeStamperConfiguration.- Parameters:
resolver
- The ObjectResolver to add to the configuration.- Returns:
- The updated OfficeStamperConfiguration.
-
getExceptionResolver
ExceptionResolver getExceptionResolver()Retrieves the instance of the ExceptionResolver.- Returns:
- the ExceptionResolver instance used to handle exceptions
-
setExceptionResolver
Sets the exception resolver to be used by the OfficeStamperConfiguration. The exception resolver determines how exceptions will be handled during the processing of office documents.- Parameters:
exceptionResolver
- the ExceptionResolver instance to set- Returns:
- the current instance of OfficeStamperConfiguration for method chaining
-
customFunctions
List<CustomFunction> customFunctions()Retrieves a list of custom functions.- Returns:
- a List containing instances of CustomFunction.
-
addCustomFunction
Adds a custom function to the system with the specified name and implementation.- Parameters:
name
- the unique name of the custom function to be addedimplementation
- a Supplier that provides the implementation of the custom function
-
addCustomFunction
Adds a custom function with the specified name and associated class type. This method allows users to define custom behavior by associating a function implementation with a given name and type.- Type Parameters:
T
- The type associated with the custom function.- Parameters:
name
- The name of the custom function to be added.class0
- The class type of the custom function.- Returns:
- An instance of NeedsFunctionImpl parameterized with the type of the custom function.
-
addCustomFunction
<T,U> CustomFunction.NeedsBiFunctionImpl<T,U> addCustomFunction(String name, Class<T> class0, Class<U> class1) Adds a custom bi-function with the specified name and the provided parameter types.- Parameters:
name
- the name of the custom function to be addedclass0
- the class type for the first parameter of the bi-functionclass1
- the class type for the second parameter of the bi-function- Returns:
- an instance of NeedsBiFunctionImpl parameterized with the provided types
-
addCustomFunction
<T,U, CustomFunction.NeedsTriFunctionImpl<T,V> U, addCustomFunctionV> (String name, Class<T> class0, Class<U> class1, Class<V> class2) Adds a custom function with the specified parameters.- Type Parameters:
T
- the type of the first parameterU
- the type of the second parameterV
- the type of the third parameter- Parameters:
name
- the name of the custom functionclass0
- the class type of the first parameterclass1
- the class type of the second parameterclass2
- the class type of the third parameter- Returns:
- an instance of NeedsTriFunctionImpl for the provided parameter types
-
getPostprocessors
List<PostProcessor> getPostprocessors()Retrieves the list of post-processors associated with this instance.- Returns:
- a list of PostProcessor objects.
-
addPostprocessor
Adds a postprocessor to modify or enhance data or operations during the processing lifecycle.- Parameters:
postProcessor
- the PostProcessor instance to be added
-