Class ConfigurationInterpolator.DefaultStringConverter

  • All Implemented Interfaces:
    java.util.function.Function<java.lang.Object,​java.lang.String>
    Enclosing class:
    ConfigurationInterpolator

    private static final class ConfigurationInterpolator.DefaultStringConverter
    extends java.lang.Object
    implements java.util.function.Function<java.lang.Object,​java.lang.String>
    Class encapsulating the default logic to convert resolved variable values into strings. This class is thread-safe.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String apply​(java.lang.Object obj)
      private java.lang.Object extractSimpleValue​(java.lang.Object obj)
      Attempt to extract a simple value from obj for use in string conversion.
      private <T> T nextOrNull​(java.util.Iterator<T> it)
      Return the next value from it or null if no values remain.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.function.Function

        andThen, compose
    • Constructor Detail

      • DefaultStringConverter

        private DefaultStringConverter()
    • Method Detail

      • apply

        public java.lang.String apply​(java.lang.Object obj)
        Specified by:
        apply in interface java.util.function.Function<java.lang.Object,​java.lang.String>
      • extractSimpleValue

        private java.lang.Object extractSimpleValue​(java.lang.Object obj)
        Attempt to extract a simple value from obj for use in string conversion. If the input represents a collection of some sort (e.g., an iterable or array), the first item from the collection is returned.
        Parameters:
        obj - input object
        Returns:
        extracted simple object
      • nextOrNull

        private <T> T nextOrNull​(java.util.Iterator<T> it)
        Return the next value from it or null if no values remain.
        Type Parameters:
        T - iterated type
        Parameters:
        it - iterator
        Returns:
        next value from it or null if no values remain