Module pro.verron.officestamper
Package pro.verron.officestamper.api
Interface OfficeStamperConfiguration
- All Known Implementing Classes:
DocxStamperConfiguration
public interface OfficeStamperConfiguration
Represents the configuration for the OfficeStamper class.
-
Method Summary
Modifier and TypeMethodDescriptionaddCommentProcessor(Class<?> interfaceClass, Function<ParagraphPlaceholderReplacer, CommentProcessor> commentProcessorFactory) Adds a comment processor to the OfficeStamperConfiguration.voidaddPreprocessor(PreProcessor preprocessor) Adds a pre-processor to the OfficeStamperConfiguration.addResolver(ObjectResolver resolver) Adds an ObjectResolver to the OfficeStamperConfiguration.addTypeResolver(Class<T> resolvedType, ITypeResolver<T> resolver) Deprecated, for removal: This API element is subject to removal in a future version.OfficeStamper<org.docx4j.openpackaging.packages.WordprocessingMLPackage> build()Deprecated, for removal: This API element is subject to removal in a future version.This method is marked for removal and should not be used.exposeInterfaceToExpressionLanguage(Class<?> interfaceClass, Object implementation) Exposes an interface to the expression language.Returns a map of comment processors associated with their respective classes.Deprecated, for removal: This API element is subject to removal in a future version.This method has been deprecated since version 1.6.7 and will be removed in a future release.Retrieves the EvaluationContextConfigurer for configuring the Spring Expression Language (SPEL) EvaluationContext used by the docxstamper.Retrieves the map of expression functions associated with their corresponding classes.Retrieves the line break placeholder used in the OfficeStamper configuration.Deprecated, for removal: This API element is subject to removal in a future version.This method has been deprecated since version 1.6.7 and will be removed in a future release.Retrieves the list of pre-processors.Retrieves the list of ObjectResolvers.org.springframework.expression.spel.SpelParserConfigurationRetrieves the SpelParserConfiguration used by the OfficeStamperConfiguration.Map<Class<?>, ITypeResolver<?>> Deprecated, for removal: This API element is subject to removal in a future version.This method has been deprecated since version 1.6.7 and will be removed in a future release.Retrieves the default value for unresolved expressions.booleanChecks if the failOnUnresolvedExpression flag is set to true or false.booleanDetermines whether to leave empty on expression error.booleanDeprecated, for removal: This API element is subject to removal in a future version.Since version 1.6.7.booleanDetermines whether unresolved expressions in the OfficeStamper configuration should be replaced.leaveEmptyOnExpressionError(boolean leaveEmpty) Configures whether to leave empty on expression error.Deprecated, for removal: This API element is subject to removal in a future version.since version 1.6.7nullValuesDefault(String nullValuesDefault) Deprecated, for removal: This API element is subject to removal in a future version.since version 1.6.7replaceNullValues(boolean replaceNullValues) Deprecated, for removal: This API element is subject to removal in a future version.since version 1.6.7replaceUnresolvedExpressions(boolean replaceUnresolvedExpressions) Replaces unresolved expressions in the OfficeStamperConfiguration object.setDefaultTypeResolver(ITypeResolver<? super Object> defaultResolver) Deprecated, for removal: This API element is subject to removal in a future version.setEvaluationContextConfigurer(EvaluationContextConfigurer evaluationContextConfigurer) Sets the EvaluationContextConfigurer for configuring the Spring Expression Language (SPEL) EvaluationContext.setFailOnUnresolvedExpression(boolean failOnUnresolvedExpression) Sets the failOnUnresolvedExpression flag to determine whether unresolved expressions should cause an exception to be thrown.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) Sets the default value for unresolved expressions in the OfficeStamperConfiguration object.
-
Method Details
-
nullReplacementValue
Deprecated, for removal: This API element is subject to removal in a future version.since version 1.6.7Retrieves the null replacement value.- Returns:
- an Optional containing the null replacement value if it exists; otherwise, an empty Optional.
-
isFailOnUnresolvedExpression
boolean isFailOnUnresolvedExpression()Checks if the failOnUnresolvedExpression flag is set to true or false.- Returns:
- true if failOnUnresolvedExpression is set to true, false otherwise.
-
setFailOnUnresolvedExpression
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
-
nullValuesDefault
@Deprecated(since="1.6.7", forRemoval=true) OfficeStamperConfiguration nullValuesDefault(String nullValuesDefault) Deprecated, for removal: This API element is subject to removal in a future version.since version 1.6.7Retrieves a new OfficeStamperConfiguration object with the provided null replacement value.- Parameters:
nullValuesDefault- the null replacement value.- Returns:
- OfficeStamperConfiguration object with the provided null replacement value.
-
replaceNullValues
@Deprecated(since="1.6.7", forRemoval=true) OfficeStamperConfiguration replaceNullValues(boolean replaceNullValues) Deprecated, for removal: This API element is subject to removal in a future version.since version 1.6.7Replaces null values in the OfficeStamperConfiguration object.- Parameters:
replaceNullValues- flag indicating whether to replace null values- Returns:
- the updated OfficeStamperConfiguration object
-
unresolvedExpressionsDefaultValue
OfficeStamperConfiguration unresolvedExpressionsDefaultValue(String unresolvedExpressionsDefaultValue) 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
Replaces unresolved expressions in the OfficeStamperConfiguration object.- Parameters:
replaceUnresolvedExpressions- flag indicating whether to replace unresolved expressions- Returns:
- the updated OfficeStamperConfiguration object
-
leaveEmptyOnExpressionError
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
-
addTypeResolver
@Deprecated(since="1.6.7", forRemoval=true) <T> OfficeStamperConfiguration addTypeResolver(Class<T> resolvedType, ITypeResolver<T> resolver) Deprecated, for removal: This API element is subject to removal in a future version.as of version 1.6.7, replaced byObjectResolver. The new resolver is more versatile, requires less reflection mechanism, and simplifies the internal workings of the docx-stamper project.Adds a type resolver to the OfficeStamperConfiguration. A type resolver is responsible for mapping an object of a certain Java class to an object of the DOCX4J api that can be put into the .docx document. Type resolvers are used to replace expressions within the .docx template.- Type Parameters:
T- type expected to be resolved by the resolver- Parameters:
resolvedType- the Java class that the type resolver is responsible for.resolver- the implementation ofITypeResolverthat resolves objects of the given type.- 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
-
build
@Deprecated(forRemoval=true, since="1.6.4") OfficeStamper<org.docx4j.openpackaging.packages.WordprocessingMLPackage> build()Deprecated, for removal: This API element is subject to removal in a future version.This method is marked for removal and should not be used. Consider using a different method instead.Retrieves the OfficeStamper configured with the current settings.- Returns:
- the OfficeStamper configured with the current settings.
- Since:
- 1.6.4
-
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
-
isReplaceUnresolvedExpressions
boolean isReplaceUnresolvedExpressions()Determines whether unresolved expressions in the OfficeStamper configuration should be replaced.- Returns:
- true if unresolved expressions should be replaced, false otherwise.
-
isLeaveEmptyOnExpressionError
boolean isLeaveEmptyOnExpressionError()Determines whether to leave empty on expression error.- Returns:
- true if expression errors are left empty, false otherwise
-
getUnresolvedExpressionsDefaultValue
String getUnresolvedExpressionsDefaultValue()Retrieves the default value for unresolved expressions.- Returns:
- the default value for unresolved expressions
-
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.
-
getTypeResolvers
Deprecated, for removal: This API element is subject to removal in a future version.This method has been deprecated since version 1.6.7 and will be removed in a future release. Use of this method is discouraged and should be replaced with an alternative implementation.Retrieves a map of type resolvers.- Returns:
- A map containing type resolvers. The keys of the map are classes and the values are instances of ITypeResolver.
-
getDefaultTypeResolver
Deprecated, for removal: This API element is subject to removal in a future version.This method has been deprecated since version 1.6.7 and will be removed in a future release.Retrieves the default type resolver.- Returns:
- The default type resolver.
-
setDefaultTypeResolver
@Deprecated(since="1.6.7", forRemoval=true) OfficeStamperConfiguration setDefaultTypeResolver(ITypeResolver<? super Object> defaultResolver) Deprecated, for removal: This API element is subject to removal in a future version.Sets the default type resolver for the OfficeStamperConfiguration. This method is deprecated and will be removed in version 1.6.7.- Parameters:
defaultResolver- the default type resolver to be set- Returns:
- the OfficeStamperConfiguration with the updated default type resolver
-
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.
-
isReplaceNullValues
Deprecated, for removal: This API element is subject to removal in a future version.Since version 1.6.7. This method will be removed in a future release.Determines whether null values should be replaced.- Returns:
- true if null values should be replaced, false otherwise.
-
getNullValuesDefault
Deprecated, for removal: This API element is subject to removal in a future version.This method has been deprecated since version 1.6.7 and will be removed in a future release.Retrieves the default value for null values.- Returns:
- The default value for null values.
-
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.
-
ObjectResolver.