Class InterpolatorSpecification.Builder

  • Enclosing class:
    InterpolatorSpecification

    public static class InterpolatorSpecification.Builder
    extends Object

    A builder class for creating instances of InterpolatorSpecification.

    This class provides a fluent API for defining the various properties of an InterpolatorSpecification object. Note: This builder class is not thread-safe.

    • Constructor Detail

    • Method Detail

      • withPrefixLookups

        public InterpolatorSpecification.Builder withPrefixLookups​(Map<String,​? extends Lookup> lookups)
        Adds the content of the given map to the prefix lookups managed by this builder. The map can be null, then this method has no effect.
        Parameters:
        lookups - the map with prefix lookups to be added
        Returns:
        a reference to this builder for method chaining
        Throws:
        IllegalArgumentException - if the map contains null values
      • withDefaultLookups

        public InterpolatorSpecification.Builder withDefaultLookups​(Collection<? extends Lookup> lookups)
        Adds the content of the given collection to the default lookups managed by this builder. The collection can be null, then this method has no effect.
        Parameters:
        lookups - the collection with lookups to be added
        Returns:
        a reference to this builder for method chaining
        Throws:
        IllegalArgumentException - if the collection contains null entries
      • withInterpolator

        public InterpolatorSpecification.Builder withInterpolator​(ConfigurationInterpolator ci)
        Sets the ConfigurationInterpolator instance for the InterpolatorSpecification. This means that a ConfigurationInterpolator has been created and set up externally and can be used directly.
        Parameters:
        ci - the ConfigurationInterpolator (can be null)
        Returns:
        a reference to this builder for method chaining
      • withParentInterpolator

        public InterpolatorSpecification.Builder withParentInterpolator​(ConfigurationInterpolator parent)
        Sets an optional parent ConfigurationInterpolator. If defined, this object is set as parent of a newly created ConfigurationInterpolator instance.
        Parameters:
        parent - the parent ConfigurationInterpolator (can be null)
        Returns:
        a reference to this builder for method chaining
      • withStringConverter

        public InterpolatorSpecification.Builder withStringConverter​(Function<Object,​String> fn)
        Sets the function used to convert interpolated values to strings. Pass null if the default conversion function is to be used.
        Parameters:
        fn - function used to convert interpolated values to string or null if the default conversion function is to be used
        Returns:
        a reference to this builder for method chaining
      • create

        public InterpolatorSpecification create()
        Creates a new InterpolatorSpecification instance with the properties set so far. After that this builder instance is reset so that it can be reused for creating further specification objects.
        Returns:
        the newly created InterpolatorSpecification
      • reset

        public void reset()
        Removes all data from this builder. Afterwards it can be used to define a brand new InterpolatorSpecification object.