Class UrfConfiguration

java.lang.Object
io.confound.config.AbstractConfiguration
io.confound.config.BaseConfiguration<Object>
io.confound.config.AbstractObjectConfiguration
io.urf.config.urf.UrfConfiguration
All Implemented Interfaces:
io.confound.config.Configuration, io.confound.config.Section

public class UrfConfiguration extends io.confound.config.AbstractObjectConfiguration implements io.confound.config.Section
Configuration implementation backed by an URF object graph.
Author:
Garret Wilson
See Also:
  • Field Summary

    Fields inherited from interface io.confound.config.Configuration

    KEY_SEGMENT_SEPARATOR, KEY_SEGMENTS_PATTERN
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    UrfConfiguration(io.confound.config.Configuration sectionRoot, Object root)
    Root configuration and URF object graph root constructor.
     
    URF object graph root constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected <O> Optional<O>
    convertValue(Optional<Object> value, Class<O> convertClass)
    protected Optional<Object>
    io.confound.config.Configuration
     

    Methods inherited from class io.confound.config.AbstractObjectConfiguration

    findBoolean, findDouble, findInt, findLong, findPath, findSection, findString, findUri

    Methods inherited from class io.confound.config.BaseConfiguration

    findCollection, findConfigurationValue, findObject, hasConfigurationValue, hasConfigurationValueImpl, normalizeKey

    Methods inherited from class io.confound.config.AbstractConfiguration

    or

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.confound.config.Configuration

    createMissingConfigurationKeyException, findBoolean, findCollection, findCollection, findDouble, findInt, findLong, findObject, findObject, findPath, findSection, findString, findUri, getBoolean, getCollection, getCollection, getDouble, getInt, getLong, getObject, getObject, getPath, getSection, getString, getUri, hasConfigurationValue, requireConfiguration, resolvePath, subConfiguration, superConfiguration, withFallback
  • Constructor Details

    • UrfConfiguration

      public UrfConfiguration(@Nonnull Object root)
      URF object graph root constructor.
      Parameters:
      root - The root object of the URF object graph.
      Throws:
      NullPointerException - if the given root object is null.
    • UrfConfiguration

      protected UrfConfiguration(@Nullable io.confound.config.Configuration sectionRoot, @Nonnull Object root)
      Root configuration and URF object graph root constructor.
      Parameters:
      sectionRoot - A reference to the root configuration for the section, or null if this configuration is the section root.
      root - The root object of the URF object graph.
      Throws:
      NullPointerException - if the given root object is null.
  • Method Details

    • getSectionRoot

      public io.confound.config.Configuration getSectionRoot()
      Specified by:
      getSectionRoot in interface io.confound.config.Section
    • getSectionType

      public Optional<String> getSectionType()
      Specified by:
      getSectionType in interface io.confound.config.Section
      Implementation Specification:
      This implementation returns the handle of the root object, if the root object is an UrfObject and has a type that can be represented as a handle. If the root object has a type that cannot be represented as a handle, it is returned as the string form of its tag.
    • findConfigurationValueImpl

      protected Optional<Object> findConfigurationValueImpl(String key) throws io.confound.config.ConfigurationException
      Specified by:
      findConfigurationValueImpl in class io.confound.config.BaseConfiguration<Object>
      Throws:
      IllegalArgumentException - if the given key has subsequent delimiters, such as "foo..bar".
      io.confound.config.ConfigurationException
    • convertValue

      protected <O> Optional<O> convertValue(Optional<Object> value, Class<O> convertClass) throws io.confound.config.ConfigurationException
      Overrides:
      convertValue in class io.confound.config.AbstractObjectConfiguration
      Implementation Specification:
      This version adds the ability to do the following conversions:
      • Converts String value from the URF model to a Path using Paths.get(String, String...) with a Path is requested.
      • Converts an UrfObject to a Section when an UrfConfiguration or any super class is requested. This means, for example, that merely requesting Object.class will convert an UrfObject to a Section. The only way to retrieve an UrfObject node would be to request UrfObject.class explicitly.
      Throws:
      io.confound.config.ConfigurationException