Package org.tomlj
Interface TomlArray
@DefaultQualifier(value=org.checkerframework.checker.nullness.qual.NonNull.class,
locations={RETURN,PARAMETER,FIELD})
public interface TomlArray
An array of TOML values.
-
Method Summary
Modifier and Type Method Description booleancontainsArrays()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.booleancontainsBooleans()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.booleancontainsDoubles()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.booleancontainsLocalDates()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.booleancontainsLocalDateTimes()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.booleancontainsLocalTimes()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.booleancontainsLongs()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.booleancontainsOffsetDateTimes()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.booleancontainsStrings()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.booleancontainsTables()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.java.lang.Objectget(int index)Get a value at a specified index.default TomlArraygetArray(int index)Get an array at a specified index.default booleangetBoolean(int index)Get a boolean at a specified index.default doublegetDouble(int index)Get a double at a specified index.default java.time.LocalDategetLocalDate(int index)Get a local date at a specified index.default java.time.LocalDateTimegetLocalDateTime(int index)Get a local date time at a specified index.default java.time.LocalTimegetLocalTime(int index)Get a local time at a specified index.default longgetLong(int index)Get a long at a specified index.default java.time.OffsetDateTimegetOffsetDateTime(int index)Get an offset date time at a specified index.default java.lang.StringgetString(int index)Get a string at a specified index.default TomlTablegetTable(int index)Get a table at a specified index.TomlPositioninputPositionOf(int index)Get the position where a value is defined in the TOML document.booleanisEmpty()trueif the array is empty.intsize()The size of the array.default voidtoJson(java.lang.Appendable appendable, java.util.EnumSet<JsonOptions> options)Append a JSON representation of this array to the appendable output.default voidtoJson(java.lang.Appendable appendable, JsonOptions... options)Append a JSON representation of this array to the appendable output.default java.lang.StringtoJson(java.util.EnumSet<JsonOptions> options)Return a representation of this array using JSON.default java.lang.StringtoJson(JsonOptions... options)Return a representation of this array using JSON.java.util.List<java.lang.Object>toList()Get the elements of this array as aList.default java.lang.StringtoToml()Return a representation of this array using TOML.default voidtoToml(java.lang.Appendable appendable)Append a TOML representation of this array to the appendable output.
-
Method Details
-
size
int size()The size of the array.- Returns:
- The size of the array.
-
isEmpty
boolean isEmpty()trueif the array is empty.- Returns:
trueif the array is empty.
-
containsStrings
boolean containsStrings()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.trueif the array contains strings.- Returns:
trueif the array contains strings.
-
containsLongs
boolean containsLongs()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.trueif the array contains longs.- Returns:
trueif the array contains longs.
-
containsDoubles
boolean containsDoubles()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.trueif the array contains doubles.- Returns:
trueif the array contains doubles.
-
containsBooleans
boolean containsBooleans()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.trueif the array contains booleans.- Returns:
trueif the array contains booleans.
-
containsOffsetDateTimes
boolean containsOffsetDateTimes()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.trueif the array containsOffsetDateTimes.- Returns:
trueif the array containsOffsetDateTimes.
-
containsLocalDateTimes
boolean containsLocalDateTimes()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.trueif the array containsLocalDateTimes.- Returns:
trueif the array containsLocalDateTimes.
-
containsLocalDates
boolean containsLocalDates()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.trueif the array containsLocalDates.- Returns:
trueif the array containsLocalDates.
-
containsLocalTimes
boolean containsLocalTimes()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.trueif the array containsLocalTimes.- Returns:
trueif the array containsLocalTimes.
-
containsArrays
boolean containsArrays()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.trueif the array contains arrays.- Returns:
trueif the array contains arrays.
-
containsTables
boolean containsTables()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.trueif the array contains tables.- Returns:
trueif the array contains tables.
-
get
java.lang.Object get(int index)Get a value at a specified index.- Parameters:
index- The array index.- Returns:
- The value.
- Throws:
java.lang.IndexOutOfBoundsException- If the index is out of bounds.
-
inputPositionOf
Get the position where a value is defined in the TOML document.- Parameters:
index- The array index.- Returns:
- The input position.
- Throws:
java.lang.IndexOutOfBoundsException- If the index is out of bounds.
-
getString
default java.lang.String getString(int index)Get a string at a specified index.- Parameters:
index- The array index.- Returns:
- The value.
- Throws:
java.lang.IndexOutOfBoundsException- If the index is out of bounds.TomlInvalidTypeException- If the value is not a long.
-
getLong
default long getLong(int index)Get a long at a specified index.- Parameters:
index- The array index.- Returns:
- The value.
- Throws:
java.lang.IndexOutOfBoundsException- If the index is out of bounds.TomlInvalidTypeException- If the value is not a long.
-
getDouble
default double getDouble(int index)Get a double at a specified index.- Parameters:
index- The array index.- Returns:
- The value.
- Throws:
java.lang.IndexOutOfBoundsException- If the index is out of bounds.TomlInvalidTypeException- If the value is not a long.
-
getBoolean
default boolean getBoolean(int index)Get a boolean at a specified index.- Parameters:
index- The array index.- Returns:
- The value.
- Throws:
java.lang.IndexOutOfBoundsException- If the index is out of bounds.TomlInvalidTypeException- If the value is not a long.
-
getOffsetDateTime
default java.time.OffsetDateTime getOffsetDateTime(int index)Get an offset date time at a specified index.- Parameters:
index- The array index.- Returns:
- The value.
- Throws:
java.lang.IndexOutOfBoundsException- If the index is out of bounds.TomlInvalidTypeException- If the value is not anOffsetDateTime.
-
getLocalDateTime
default java.time.LocalDateTime getLocalDateTime(int index)Get a local date time at a specified index.- Parameters:
index- The array index.- Returns:
- The value.
- Throws:
java.lang.IndexOutOfBoundsException- If the index is out of bounds.TomlInvalidTypeException- If the value is not anLocalDateTime.
-
getLocalDate
default java.time.LocalDate getLocalDate(int index)Get a local date at a specified index.- Parameters:
index- The array index.- Returns:
- The value.
- Throws:
java.lang.IndexOutOfBoundsException- If the index is out of bounds.TomlInvalidTypeException- If the value is not anLocalDate.
-
getLocalTime
default java.time.LocalTime getLocalTime(int index)Get a local time at a specified index.- Parameters:
index- The array index.- Returns:
- The value.
- Throws:
java.lang.IndexOutOfBoundsException- If the index is out of bounds.TomlInvalidTypeException- If the value is not anLocalTime.
-
getArray
Get an array at a specified index.- Parameters:
index- The array index.- Returns:
- The value.
- Throws:
java.lang.IndexOutOfBoundsException- If the index is out of bounds.TomlInvalidTypeException- If the value is not an array.
-
getTable
Get a table at a specified index.- Parameters:
index- The array index.- Returns:
- The value.
- Throws:
java.lang.IndexOutOfBoundsException- If the index is out of bounds.TomlInvalidTypeException- If the value is not a table.
-
toList
java.util.List<java.lang.Object> toList()Get the elements of this array as aList.Note that this does not do a deep conversion. If this array contains tables or arrays, they will be of type
TomlTableorTomlArrayrespectively.- Returns:
- The elements of this array as a
List.
-
toJson
Return a representation of this array using JSON.- Parameters:
options- Options for the JSON encoder.- Returns:
- A JSON representation of this table.
-
toJson
Return a representation of this array using JSON.- Parameters:
options- Options for the JSON encoder.- Returns:
- A JSON representation of this table.
-
toJson
default void toJson(java.lang.Appendable appendable, JsonOptions... options) throws java.io.IOExceptionAppend a JSON representation of this array to the appendable output.- Parameters:
appendable- The appendable output.options- Options for the JSON encoder.- Throws:
java.io.IOException- If an IO error occurs.
-
toJson
default void toJson(java.lang.Appendable appendable, java.util.EnumSet<JsonOptions> options) throws java.io.IOExceptionAppend a JSON representation of this array to the appendable output.- Parameters:
appendable- The appendable output.options- Options for the JSON encoder.- Throws:
java.io.IOException- If an IO error occurs.
-
toToml
default java.lang.String toToml()Return a representation of this array using TOML.- Returns:
- A TOML representation of this array.
-
toToml
default void toToml(java.lang.Appendable appendable) throws java.io.IOExceptionAppend a TOML representation of this array to the appendable output.- Parameters:
appendable- The appendable output.- Throws:
java.io.IOException- If an IO error occurs.
-