Module: Hocon::ConfigList

Includes:
ConfigValue
Included in:
Impl::SimpleConfigList
Defined in:
lib/hocon/config_list.rb

Overview

Subtype of ConfigValue representing a list value, as in JSON’s [1,2,3] syntax.

<p> ConfigList implements java.util.List<ConfigValue> so you can use it like a regular Java list. Or call #unwrapped() to unwrap the list elements into plain Java values.

<p> Like all ConfigValue subtypes, ConfigList is immutable. This makes it threadsafe and you never have to create “defensive copies.” The mutator methods from java.util.List all throw java.lang.UnsupportedOperationException.

<p> The ConfigValue#valueType method on a list returns ConfigValueType#LIST.

<p> Do not implement ConfigList; it should only be implemented by the config library. Arbitrary implementations will not work because the library internals assume a specific concrete implementation. Also, this interface is likely to grow new methods over time, so third-party implementations will break.

Instance Method Summary collapse

Methods included from ConfigValue

#at_key, #at_path, #origin, #render, #value_type, #with_fallback

Methods included from ConfigMergeable

#with_fallback

Instance Method Details

#unwrappedObject

Recursively unwraps the list, returning a list of plain Java values such as Integer or String or whatever is in the list.



41
42
43
# File 'lib/hocon/config_list.rb', line 41

def unwrapped
  raise Hocon::ConfigError::ConfigBugOrBrokenError, "subclasses of ConfigValue should provide their own implementation of `unwrapped` (#{self.class})"
end

#with_origin(origin) ⇒ Object



45
46
47
# File 'lib/hocon/config_list.rb', line 45

def with_origin(origin)
  raise Hocon::ConfigError::ConfigBugOrBrokenError, "subclasses of ConfigValue should provide their own implementation of `with_origin` (#{self.class})"
end