Class VarResolver.Builder
- Enclosing class:
- VarResolver
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBuilder()Constructor.protectedBuilder(VarResolver copyFrom) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionAdds a bean to the resolvedVarResolver's local bean store.Returns the bean store used by this builder.build()Builds the var resolver.Registers the built-inVarFunctioncatalog plus any third-party functions discovered viaServiceLoader.load(Class)onVarFunction.Adds the default variables to this builder.final VarResolver.Builderfunctions(Class<? extends VarFunction>... values) Register one or moreVarFunctionclasses on this builder.functions(VarFunction... values) Register one or moreVarFunctioninstances on this builder.final VarResolver.BuilderRegister new variables with this resolver.Register new variables with this resolver.Register new variables with this resolver.
-
Constructor Details
-
Builder
protected Builder()Constructor. -
Builder
Copy constructor.- Parameters:
copyFrom- The bean to copy from. Must not benull.
-
-
Method Details
-
beanStore
Returns the bean store used by this builder.- Returns:
- The bean store used by this builder.
-
bean
Adds a bean to the resolvedVarResolver's local bean store.The bean is stored on this builder and merged into the resolver's local bean store at
build()time. The parent bean store passed at construction is not mutated, so beans added here are isolated toVarResolvers built from this builder.- Type Parameters:
T- The bean type.- Parameters:
c- The bean type.value- The bean.- Returns:
- This object .
-
defaultVars
Adds the default variables to this builder.The default variables are:
The 11 transformation
Vars previously listed here (SwitchVar,IfVar,CoalesceVar,PatternMatchVar,PatternReplaceVar,PatternExtractVar,UpperCaseVar,LowerCaseVar,NotEmptyVar,LenVar,SubstringVar) were deleted in 10.0.0 and replaced by the#{...}script syntax. UsedefaultFunctions()to register the built-in catalog.- Returns:
- This object .
-
vars
Register new variables with this resolver.- Parameters:
values- The variable resolver classes. These classes must subclass fromVarand have no-arg constructors.- Returns:
- This object .
-
vars
Register new variables with this resolver.- Parameters:
values- The variable resolver classes. These classes must subclass fromVarand have no-arg constructors.- Returns:
- This object .
-
vars
Register new variables with this resolver.- Parameters:
values- The variable resolver classes. These classes must subclass fromVarand have no-arg constructors.- Returns:
- This object .
-
functions
Register one or moreVarFunctioninstances on this builder.Functions registered here win over
BeanStore/ServiceLoader/ built-in catalog entries with the samename(later-wins-on-collision). Discovery channels merge these registrations with the auto-discovered set atbuild()time.- Parameters:
values- The functions to register.- Returns:
- This builder.
-
functions
Register one or moreVarFunctionclasses on this builder. Each class must have a public no-arg constructor; instances are created via the bean store atbuild()time so dependency injection works the same way it does forVars.- Parameters:
values- The function classes to register.- Returns:
- This builder.
-
defaultFunctions
Registers the built-inVarFunctioncatalog plus any third-party functions discovered viaServiceLoader.load(Class)onVarFunction.Registration order is:
- Built-in catalog — string, type-conversion, arithmetic, boolean, conditional, regex, encoding, date, random/UUID, and JSON-navigation functions.
- Third-party functions from
META-INF/services/org.apache.juneau.commons.svl.VarFunction.
Later registrations win on name collision — third-party
ServiceLoaderentries override built-ins, and explicitfunctions(VarFunction...)/functions(Class...)calls override both.- Returns:
- This builder.
-
build
Builds the var resolver.- Returns:
- A new
VarResolver.
-