Class 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:
    Uniform Resource Framework (URF)
    • 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, java.lang.Object root)
      Root configuration and URF object graph root constructor.
        UrfConfiguration​(java.lang.Object root)
      URF object graph root constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected <O> java.util.Optional<O> convertValue​(java.util.Optional<java.lang.Object> value, java.lang.Class<O> convertClass)
      protected java.util.Optional<java.lang.Object> findConfigurationValueImpl​(java.lang.String key)
      io.confound.config.Configuration getSectionRoot()  
      java.util.Optional<java.lang.String> getSectionType()
      • 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 Detail

      • UrfConfiguration

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

        protected UrfConfiguration​(@Nullable
                                   io.confound.config.Configuration sectionRoot,
                                   @Nonnull
                                   java.lang.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:
        java.lang.NullPointerException - if the given root object is null.
    • Method Detail

      • getSectionRoot

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

        public java.util.Optional<java.lang.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 java.util.Optional<java.lang.Object> findConfigurationValueImpl​(java.lang.String key)
                                                                           throws io.confound.config.ConfigurationException
        Specified by:
        findConfigurationValueImpl in class io.confound.config.BaseConfiguration<java.lang.Object>
        Throws:
        java.lang.IllegalArgumentException - if the given key has subsequent delimiters, such as "foo..bar".
        io.confound.config.ConfigurationException
      • convertValue

        protected <O> java.util.Optional<O> convertValue​(java.util.Optional<java.lang.Object> value,
                                                         java.lang.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