Class Resolvers
java.lang.Object
pro.verron.docxstamper.preset.resolver.Resolvers
The Resolvers class provides static methods to create different types of ObjectResolvers.
- Since:
- 1.6.7
- Version:
- ${version}
- Author:
- Joseph Verron
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectResolverfallback()Returns an instance of ObjectResolver that acts as a fallback resolver.static ObjectResolverimage()Returns an instance of ImageResolver that allows context objects to return objects of type Image.static ObjectResolverisoDate()Returns an instance ofLocalDateResolver.static ObjectResolverisoDate(DateTimeFormatter formatter) Returns an instance of LocalDateResolver that resolvesLocalDateobjects by formatting them with the givenDateTimeFormatter.static ObjectResolverReturns an instance of LocalTimeResolver.static ObjectResolverisoTime()Returns an instance ofLocalDateTimeResolver.static ObjectResolverisoTime(DateTimeFormatter formatter) Creates a new instance of LocalDateTimeResolver using the given formatter.static ObjectResolverReturns an instance of DateResolver.static ObjectResolverlegacyDate(DateTimeFormatter formatter) This method returns an instance of DateResolver that creates a formatted date string for expressions that return a Date object.static ObjectResolvernullToDefault(String value) Returns an instance of ObjectResolver that resolves null objects by creating a run with a default text value.static ObjectResolverReturns an instance of ObjectResolver that replaces null values with an empty string.static ObjectResolverReturns an instance of ObjectResolver that resolves null objects by not replacing their placeholder string.
-
Constructor Details
-
Resolvers
public Resolvers()
-
-
Method Details
-
fallback
Returns an instance of ObjectResolver that acts as a fallback resolver. It uses the ToStringResolver implementation of ObjectResolver.- Returns:
- An instance of ObjectResolver
-
nullToEmpty
Returns an instance of ObjectResolver that replaces null values with an empty string.- Returns:
- An instance of ObjectResolver
-
nullToDefault
Returns an instance of ObjectResolver that resolves null objects by creating a run with a default text value.- Parameters:
value- The default value for null objects.- Returns:
- An instance of ObjectResolver
-
nullToPlaceholder
Returns an instance of ObjectResolver that resolves null objects by not replacing their placeholder string.- Returns:
- An instance of ObjectResolver
-
isoDateTime
Returns an instance of LocalTimeResolver. The LocalTimeResolver class is an implementation of the StringResolver interface that resolves LocalTime values to a formatted string using the ISO_LOCAL_TIME pattern.- Returns:
- An instance of LocalTimeResolver
-
isoTime
Returns an instance ofLocalDateTimeResolver. The LocalDateTimeResolver class is an implementation of theObjectResolverinterface that resolvesLocalDateTimevalues to a formatted string.- Returns:
- An instance of LocalDateTimeResolver
-
isoTime
Creates a new instance of LocalDateTimeResolver using the given formatter.- Parameters:
formatter- the DateTimeFormatter to use for formatting LocalDateTime values- Returns:
- a new instance of LocalDateTimeResolver
-
isoDate
Returns an instance ofLocalDateResolver. The LocalDateResolver class is an implementation of theStringResolverinterface that resolvesLocalDateobjects by formatting them with aDateTimeFormatter.- Returns:
- An instance of LocalDateResolver
-
isoDate
Returns an instance of LocalDateResolver that resolvesLocalDateobjects by formatting them with the givenDateTimeFormatter.- Parameters:
formatter- the DateTimeFormatter to use for formatting LocalDate values- Returns:
- an instance of LocalDateResolver
-
legacyDate
Returns an instance of DateResolver. The DateResolver class is an implementation of the StringResolver interface that creates a formatted date string for expressions that return a Date object.- Returns:
- An instance of DateResolver
-
legacyDate
This method returns an instance of DateResolver that creates a formatted date string for expressions that return a Date object.- Parameters:
formatter- the format to use for date formatting. See java.time.format.DateTimeFormatter.- Returns:
- an instance of DateResolver
-
image
Returns an instance of ImageResolver that allows context objects to return objects of type Image. An expression that resolves to an Image object will be replaced by an actual image in the resulting .docx document. The image will be put as an inline into the surrounding paragraph of text.- Returns:
- An instance of ImageResolver
-