Class ContextConfiguration.Builder

java.lang.Object
com.hubspot.jinjava.interpret.ContextConfiguration.Builder
Enclosing class:
ContextConfiguration

@NotThreadSafe public static final class ContextConfiguration.Builder extends Object
Builds instances of type ContextConfiguration. Initialize attributes and then invoke the build() method to create an immutable instance.

Builder is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.

  • Method Details

    • from

      Fill a builder with attribute values from the provided ContextConfigurationIF instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.
      Parameters:
      instance - The instance from which to copy values
      Returns:
      this builder for use in a chained invocation
    • setExpressionStrategy

      public final ContextConfiguration.Builder setExpressionStrategy(ExpressionStrategy expressionStrategy)
      Initializes the value for the expressionStrategy attribute.

      If not set, this attribute will have a default value as returned by the initializer of expressionStrategy.

      Parameters:
      expressionStrategy - The value for expressionStrategy
      Returns:
      this builder for use in a chained invocation
    • setDynamicVariableResolver

      public final ContextConfiguration.Builder setDynamicVariableResolver(@Nullable DynamicVariableResolver dynamicVariableResolver)
      Initializes the value for the dynamicVariableResolver attribute.
      Parameters:
      dynamicVariableResolver - The value for dynamicVariableResolver (can be null)
      Returns:
      this builder for use in a chained invocation
    • setValidationMode

      public final ContextConfiguration.Builder setValidationMode(boolean validationMode)
      Initializes the value for the validationMode attribute.

      If not set, this attribute will have a default value as returned by the initializer of validationMode.

      Parameters:
      validationMode - The value for validationMode
      Returns:
      this builder for use in a chained invocation
    • setDeferredExecutionMode

      public final ContextConfiguration.Builder setDeferredExecutionMode(boolean deferredExecutionMode)
      Initializes the value for the deferredExecutionMode attribute.

      If not set, this attribute will have a default value as returned by the initializer of deferredExecutionMode.

      Parameters:
      deferredExecutionMode - The value for deferredExecutionMode
      Returns:
      this builder for use in a chained invocation
    • setDeferLargeObjects

      public final ContextConfiguration.Builder setDeferLargeObjects(boolean deferLargeObjects)
      Initializes the value for the deferLargeObjects attribute.

      If not set, this attribute will have a default value as returned by the initializer of deferLargeObjects.

      Parameters:
      deferLargeObjects - The value for deferLargeObjects
      Returns:
      this builder for use in a chained invocation
    • setPartialMacroEvaluation

      public final ContextConfiguration.Builder setPartialMacroEvaluation(boolean partialMacroEvaluation)
      Initializes the value for the partialMacroEvaluation attribute.

      If not set, this attribute will have a default value as returned by the initializer of partialMacroEvaluation.

      Parameters:
      partialMacroEvaluation - The value for partialMacroEvaluation
      Returns:
      this builder for use in a chained invocation
    • setUnwrapRawOverride

      public final ContextConfiguration.Builder setUnwrapRawOverride(boolean unwrapRawOverride)
      Initializes the value for the unwrapRawOverride attribute.

      If not set, this attribute will have a default value as returned by the initializer of unwrapRawOverride.

      Parameters:
      unwrapRawOverride - The value for unwrapRawOverride
      Returns:
      this builder for use in a chained invocation
    • setErrorHandlingStrategy

      public final ContextConfiguration.Builder setErrorHandlingStrategy(ErrorHandlingStrategy errorHandlingStrategy)
      Initializes the value for the errorHandlingStrategy attribute.

      If not set, this attribute will have a default value as returned by the initializer of errorHandlingStrategy.

      Parameters:
      errorHandlingStrategy - The value for errorHandlingStrategy
      Returns:
      this builder for use in a chained invocation
    • build

      public ContextConfiguration build()
      Builds a new ContextConfiguration.
      Returns:
      An immutable instance of ContextConfiguration
      Throws:
      com.hubspot.immutables.validation.InvalidImmutableStateException - if any required attributes are missing