Class HoconValue
This class represents the root type for a HOCON (Human-Optimized Config Object Notation) configuration object.
Implements
Inherited Members
Namespace: Akka.Configuration.Hocon
Assembly: Akka.dll
Syntax
public class HoconValue : IMightBeAHoconObject
Constructors
| Improve this Doc View SourceHoconValue()
Initializes a new instance of the HoconValue class.
Declaration
public HoconValue()
HoconValue(List<IHoconElement>, Boolean)
Initializes a new instance of the HoconValue class.
Declaration
public HoconValue(List<IHoconElement> values, bool adoptedFromFallback = true)
Parameters
Type | Name | Description |
---|---|---|
List<IHoconElement> | values | The list of elements inside this HOCON value. |
Boolean | adoptedFromFallback | Indicates whether this instance was constructed during association with fallback Config. |
Properties
| Improve this Doc View SourceIsEmpty
Returns true if this HOCON value doesn't contain any elements
Declaration
public bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
Boolean |
Values
The list of elements inside this HOCON value
Declaration
public List<IHoconElement> Values { get; }
Property Value
Type | Description |
---|---|
List<IHoconElement> |
Methods
| Improve this Doc View SourceAppendValue(IHoconElement)
Adds the given element to the list of elements inside this HoconValue.
Declaration
public void AppendValue(IHoconElement value)
Parameters
Type | Name | Description |
---|---|---|
IHoconElement | value | The element to add to the list. |
AtKey(String)
Wraps this HoconValue into a new Config object at the specified key.
Declaration
public Config AtKey(string key)
Parameters
Type | Name | Description |
---|---|---|
String | key | The key designated to be the new root element. |
Returns
Type | Description |
---|---|
Config | A Config with the given key as the root element. |
Clear()
Clears the list of elements inside this HoconValue.
Declaration
public void Clear()
GetArray()
Retrieves a list of values from this HoconValue.
Declaration
public IList<HoconValue> GetArray()
Returns
Type | Description |
---|---|
IList<HoconValue> | A list of values represented by this HoconValue. |
GetBoolean()
Retrieves the boolean value from this HoconValue.
Declaration
public bool GetBoolean()
Returns
Type | Description |
---|---|
Boolean | The boolean value represented by this HoconValue. |
Exceptions
Type | Condition |
---|---|
NotSupportedException | This exception is thrown if the HoconValue doesn't conform to the standard boolean values: "on", "off", "true", or "false" |
GetBooleanList()
Retrieves a list of boolean values from this HoconValue.
Declaration
public IList<bool> GetBooleanList()
Returns
Type | Description |
---|---|
IList<Boolean> | A list of boolean values represented by this HoconValue. |
GetByte()
Retrieves the byte value from this HoconValue.
Declaration
public byte GetByte()
Returns
Type | Description |
---|---|
Byte | The byte value represented by this HoconValue. |
GetByteList()
Retrieves a list of byte values from this HoconValue.
Declaration
public IList<byte> GetByteList()
Returns
Type | Description |
---|---|
IList<Byte> | A list of byte values represented by this HoconValue. |
GetByteSize()
Retrieves the long value, optionally suffixed with a case sensitive byte size suffix, from this HoconValue. An empty value results in null.
Declaration
public long? GetByteSize()
Returns
Type | Description |
---|---|
Nullable<Int64> | The long value represented by this HoconValue. |
GetChildObject(String)
Retrieves the child object located at the given key.
Declaration
public HoconValue GetChildObject(string key)
Parameters
Type | Name | Description |
---|---|---|
String | key | The key used to retrieve the child object. |
Returns
Type | Description |
---|---|
HoconValue | The element at the given key. |
GetDecimal()
Retrieves the decimal value from this HoconValue.
Declaration
public decimal GetDecimal()
Returns
Type | Description |
---|---|
Decimal | The decimal value represented by this HoconValue. |
GetDecimalList()
Retrieves a list of decimal values from this HoconValue.
Declaration
public IList<decimal> GetDecimalList()
Returns
Type | Description |
---|---|
IList<Decimal> | A list of decimal values represented by this HoconValue. |
GetDouble()
Retrieves the double value from this HoconValue.
Declaration
public double GetDouble()
Returns
Type | Description |
---|---|
Double | The double value represented by this HoconValue. |
GetDoubleList()
Retrieves a list of double values from this HoconValue.
Declaration
public IList<double> GetDoubleList()
Returns
Type | Description |
---|---|
IList<Double> | A list of double values represented by this HoconValue. |
GetFloat()
Retrieves the float value from this HoconValue.
Declaration
public float GetFloat()
Returns
Type | Description |
---|---|
Single | The float value represented by this HoconValue. |
GetFloatList()
Retrieves a list of float values from this HoconValue.
Declaration
public IList<float> GetFloatList()
Returns
Type | Description |
---|---|
IList<Single> | A list of float values represented by this HoconValue. |
GetInt()
Retrieves the integer value from this HoconValue.
Declaration
public int GetInt()
Returns
Type | Description |
---|---|
Int32 | The integer value represented by this HoconValue. |
GetIntList()
Retrieves a list of integer values from this HoconValue.
Declaration
public IList<int> GetIntList()
Returns
Type | Description |
---|---|
IList<Int32> | A list of integer values represented by this HoconValue. |
GetLong()
Retrieves the long value from this HoconValue.
Declaration
public long GetLong()
Returns
Type | Description |
---|---|
Int64 | The long value represented by this HoconValue. |
GetLongList()
Retrieves a list of long values from this HoconValue.
Declaration
public IList<long> GetLongList()
Returns
Type | Description |
---|---|
IList<Int64> | A list of long values represented by this HoconValue. |
GetObject()
Retrieves the HoconObject from this HoconValue.
Declaration
public HoconObject GetObject()
Returns
Type | Description |
---|---|
HoconObject | The HoconObject that represents this HoconValue. |
GetString()
Retrieves the string value from this HoconValue.
Declaration
public string GetString()
Returns
Type | Description |
---|---|
String | The string value represented by this HoconValue. |
GetStringList()
Retrieves a list of string values from this HoconValue.
Declaration
public IList<string> GetStringList()
Returns
Type | Description |
---|---|
IList<String> | A list of string values represented by this HoconValue. |
GetTimeSpan(Boolean)
Retrieves the time span value from this HoconValue.
Declaration
public TimeSpan GetTimeSpan(bool allowInfinite = true)
Parameters
Type | Name | Description |
---|---|---|
Boolean | allowInfinite | A flag used to set infinite durations. |
Returns
Type | Description |
---|---|
TimeSpan | The time span value represented by this HoconValue. |
Exceptions
Type | Condition |
---|---|
FormatException | This exception is thrown if the timespan given in the HoconValue is negative. |
IsArray()
Determines whether this HoconValue is an array.
Declaration
public bool IsArray()
Returns
Type | Description |
---|---|
Boolean |
|
IsObject()
Determines if this HoconValue is a HoconObject.
Declaration
public bool IsObject()
Returns
Type | Description |
---|---|
Boolean |
|
IsString()
Determines whether all the elements inside this HoconValue are a string.
Declaration
public bool IsString()
Returns
Type | Description |
---|---|
Boolean |
|
NewValue(IHoconElement)
Creates a fresh list of elements inside this HoconValue and adds the given value to the list.
Declaration
public void NewValue(IHoconElement value)
Parameters
Type | Name | Description |
---|---|---|
IHoconElement | value | The element to add to the list. |
ToConfig()
Declaration
public Config ToConfig()
Returns
Type | Description |
---|---|
Config |
ToString()
Returns a HOCON string representation of this HoconValue.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | A HOCON string representation of this HoconValue. |
Overrides
| Improve this Doc View SourceToString(Int32)
Returns a HOCON string representation of this HoconValue.
Declaration
public virtual string ToString(int indent)
Parameters
Type | Name | Description |
---|---|---|
Int32 | indent | The number of spaces to indent the string. |
Returns
Type | Description |
---|---|
String | A HOCON string representation of this HoconValue. |