Interface ConfigurationPath

All Superinterfaces:
Iterable<ConfigurationPath.ConfigurationSegment>

public sealed interface ConfigurationPath extends Iterable<ConfigurationPath.ConfigurationSegment>
Models a configuration path such as those declared within ConfigurationProperties and EachProperty declarations.
Since:
4.0.0
Author:
graemerocher
  • Method Details

    • newPath

      Returns:
      Creates a new path.
    • of

      @NonNull static @NonNull ConfigurationPath of(BeanDefinition<?>... definitions)
      Computes the path for the given nested chain of definitions.
      Parameters:
      definitions - The definitions
      Returns:
      THe computed path
    • hasDynamicSegments

      boolean hasDynamicSegments()
      A configuration can have dynamic segments if it is nested within a EachProperty instance.
      Returns:
      True if the path has any dynamic segments (ie types annotated with EachProperty
    • copy

      Copy the state the of the path detaching it from any downstream mutations.
      Returns:
      The copied path
    • parent

      Returns:
      The parent of the current path.
    • prefix

      Compute the prefix to resolve properties based on the current state of the path and the given prefix.
      Returns:
      The resolved path
    • path

      Returns:
      The path without segments substituted.
    • primary

      Returns:
      The current primary
    • kind

      Returns:
      The current kind
    • name

      Returns:
      The current bound name if any.
    • index

      int index()
      Returns:
      The current index or -1 if there is none
    • propertyCatalog

      @NonNull default @NonNull PropertyCatalog propertyCatalog()
      Returns:
      the current property catalog
      Since:
      4.7.0
    • beanQualifier

      @Nullable default <T> @Nullable Qualifier<T> beanQualifier()
      Type Parameters:
      T - The bean type
      Returns:
      The qualifier.
    • isList

      default boolean isList()
      Returns:
      Is the current binding a list.
    • peekLast

      Returns:
      The last entry.
    • isPrimary

      default boolean isPrimary()
      Returns:
      Is the current segment the primary.
    • pushEachPropertyRoot

      void pushEachPropertyRoot(@NonNull @NonNull BeanDefinition<?> beanDefinition)
      Push a new configuration segment for the given name and kind
      Parameters:
      beanDefinition - The bean definition
    • pushConfigurationReader

      void pushConfigurationReader(@NonNull @NonNull BeanDefinition<?> beanDefinition)
      Push a new configuration segment for the given name and kind
      Parameters:
      beanDefinition - The bean definition
    • pushConfigurationSegment

      void pushConfigurationSegment(@NonNull @NonNull String name)
      Adds a named segment.
      Parameters:
      name - The name of the segment
    • pushConfigurationSegment

      void pushConfigurationSegment(int index)
      Adds a indexed segment.
      Parameters:
      index - The index of the segment
    • removeLast

      remove last entry.
      Returns:
      the last element from this path
      Throws:
      NoSuchElementException - if there isn't any remaining elements.
    • isNotEmpty

      boolean isNotEmpty()
      Returns:
      Whether the path is not empty.
    • resolveValue

      @NonNull @NonNull String resolveValue(String value)
      Resolve the given value with the current state.
      Parameters:
      value - The value
      Returns:
      The resolved value
    • configurationType

      @Nullable @Nullable Class<?> configurationType()
      Returns:
      The current configuration type.
    • simpleName

      @Nullable @Nullable String simpleName()
      Returns:
      The simple unqualified name if any.
    • traverseResolvableSegments

      void traverseResolvableSegments(@NonNull @NonNull PropertyResolver propertyResolver, @NonNull @NonNull Consumer<ConfigurationPath> callback)
      Traverse the enabled segments for this path invoking the given callback.
      Parameters:
      propertyResolver - The property resolver to use.
      callback - The callback.
    • pushConfigurationSegment

      void pushConfigurationSegment(@NonNull @NonNull ConfigurationPath.ConfigurationSegment configurationSegment)
      Push and adapt an existing configuration segment.
      Parameters:
      configurationSegment - The configuration segment
    • isWithin

      boolean isWithin(String prefix)
      Check whether the given prefix is within the current path.
      Parameters:
      prefix - The prefix
      Returns:
      True if it is within the current path.