Package org.tomlj
Interface TomlArray
- All Known Implementing Classes:
EmptyTomlArray
,MutableHomogeneousTomlArray
,MutableTomlArray
@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 TypeMethodDescriptionboolean
Deprecated.Future releases will support heterogeneous arrays and this method will be removed.boolean
Deprecated.Future releases will support heterogeneous arrays and this method will be removed.boolean
Deprecated.Future releases will support heterogeneous arrays and this method will be removed.boolean
Deprecated.Future releases will support heterogeneous arrays and this method will be removed.boolean
Deprecated.Future releases will support heterogeneous arrays and this method will be removed.boolean
Deprecated.Future releases will support heterogeneous arrays and this method will be removed.boolean
Deprecated.Future releases will support heterogeneous arrays and this method will be removed.boolean
Deprecated.Future releases will support heterogeneous arrays and this method will be removed.boolean
Deprecated.Future releases will support heterogeneous arrays and this method will be removed.boolean
Deprecated.Future releases will support heterogeneous arrays and this method will be removed.get
(int index) Get a value at a specified index.default TomlArray
getArray
(int index) Get an array at a specified index.default boolean
getBoolean
(int index) Get a boolean at a specified index.default double
getDouble
(int index) Get a double at a specified index.default LocalDate
getLocalDate
(int index) Get a local date at a specified index.default LocalDateTime
getLocalDateTime
(int index) Get a local date time at a specified index.default LocalTime
getLocalTime
(int index) Get a local time at a specified index.default long
getLong
(int index) Get a long at a specified index.default OffsetDateTime
getOffsetDateTime
(int index) Get an offset date time at a specified index.default String
getString
(int index) Get a string at a specified index.default TomlTable
getTable
(int index) Get a table at a specified index.inputPositionOf
(int index) Get the position where a value is defined in the TOML document.boolean
isEmpty()
true
if the array is empty.int
size()
The size of the array.default void
toJson
(Appendable appendable, EnumSet<JsonOptions> options) Append a JSON representation of this array to the appendable output.default void
toJson
(Appendable appendable, JsonOptions... options) Append a JSON representation of this array to the appendable output.default String
toJson
(EnumSet<JsonOptions> options) Return a representation of this array using JSON.default String
toJson
(JsonOptions... options) Return a representation of this array using JSON.toList()
Get the elements of this array as aList
.default String
toToml()
Return a representation of this array using TOML.default void
toToml
(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()true
if the array is empty.- Returns:
true
if the array is empty.
-
containsStrings
boolean containsStrings()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.true
if the array contains strings.- Returns:
true
if the array contains strings.
-
containsLongs
boolean containsLongs()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.true
if the array contains longs.- Returns:
true
if the array contains longs.
-
containsDoubles
boolean containsDoubles()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.true
if the array contains doubles.- Returns:
true
if the array contains doubles.
-
containsBooleans
boolean containsBooleans()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.true
if the array contains booleans.- Returns:
true
if the array contains booleans.
-
containsOffsetDateTimes
boolean containsOffsetDateTimes()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.true
if the array containsOffsetDateTime
s.- Returns:
true
if the array containsOffsetDateTime
s.
-
containsLocalDateTimes
boolean containsLocalDateTimes()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.true
if the array containsLocalDateTime
s.- Returns:
true
if the array containsLocalDateTime
s.
-
containsLocalDates
boolean containsLocalDates()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.true
if the array containsLocalDate
s.- Returns:
true
if the array containsLocalDate
s.
-
containsLocalTimes
boolean containsLocalTimes()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.true
if the array containsLocalTime
s.- Returns:
true
if the array containsLocalTime
s.
-
containsArrays
boolean containsArrays()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.true
if the array contains arrays.- Returns:
true
if the array contains arrays.
-
containsTables
boolean containsTables()Deprecated.Future releases will support heterogeneous arrays and this method will be removed.true
if the array contains tables.- Returns:
true
if the array contains tables.
-
get
Get a value at a specified index.- Parameters:
index
- The array index.- Returns:
- The value.
- Throws:
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:
IndexOutOfBoundsException
- If the index is out of bounds.
-
getString
Get a string at a specified index.- Parameters:
index
- The array index.- Returns:
- The value.
- Throws:
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:
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:
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:
IndexOutOfBoundsException
- If the index is out of bounds.TomlInvalidTypeException
- If the value is not a long.
-
getOffsetDateTime
Get an offset date time at a specified index.- Parameters:
index
- The array index.- Returns:
- The value.
- Throws:
IndexOutOfBoundsException
- If the index is out of bounds.TomlInvalidTypeException
- If the value is not anOffsetDateTime
.
-
getLocalDateTime
Get a local date time at a specified index.- Parameters:
index
- The array index.- Returns:
- The value.
- Throws:
IndexOutOfBoundsException
- If the index is out of bounds.TomlInvalidTypeException
- If the value is not anLocalDateTime
.
-
getLocalDate
Get a local date at a specified index.- Parameters:
index
- The array index.- Returns:
- The value.
- Throws:
IndexOutOfBoundsException
- If the index is out of bounds.TomlInvalidTypeException
- If the value is not anLocalDate
.
-
getLocalTime
Get a local time at a specified index.- Parameters:
index
- The array index.- Returns:
- The value.
- Throws:
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:
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:
IndexOutOfBoundsException
- If the index is out of bounds.TomlInvalidTypeException
- If the value is not a table.
-
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
TomlTable
orTomlArray
respectively.- 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
Append a JSON representation of this array to the appendable output.- Parameters:
appendable
- The appendable output.options
- Options for the JSON encoder.- Throws:
IOException
- If an IO error occurs.
-
toJson
Append a JSON representation of this array to the appendable output.- Parameters:
appendable
- The appendable output.options
- Options for the JSON encoder.- Throws:
IOException
- If an IO error occurs.
-
toToml
Return a representation of this array using TOML.- Returns:
- A TOML representation of this array.
-
toToml
Append a TOML representation of this array to the appendable output.- Parameters:
appendable
- The appendable output.- Throws:
IOException
- If an IO error occurs.
-