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 boolean
containsArrays()
Deprecated.Future releases will support heterogeneous arrays and this method will be removed.boolean
containsBooleans()
Deprecated.Future releases will support heterogeneous arrays and this method will be removed.boolean
containsDoubles()
Deprecated.Future releases will support heterogeneous arrays and this method will be removed.boolean
containsLocalDates()
Deprecated.Future releases will support heterogeneous arrays and this method will be removed.boolean
containsLocalDateTimes()
Deprecated.Future releases will support heterogeneous arrays and this method will be removed.boolean
containsLocalTimes()
Deprecated.Future releases will support heterogeneous arrays and this method will be removed.boolean
containsLongs()
Deprecated.Future releases will support heterogeneous arrays and this method will be removed.boolean
containsOffsetDateTimes()
Deprecated.Future releases will support heterogeneous arrays and this method will be removed.boolean
containsStrings()
Deprecated.Future releases will support heterogeneous arrays and this method will be removed.boolean
containsTables()
Deprecated.Future releases will support heterogeneous arrays and this method will be removed.java.lang.Object
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 java.time.LocalDate
getLocalDate(int index)
Get a local date at a specified index.default java.time.LocalDateTime
getLocalDateTime(int index)
Get a local date time at a specified index.default java.time.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 java.time.OffsetDateTime
getOffsetDateTime(int index)
Get an offset date time at a specified index.default java.lang.String
getString(int index)
Get a string at a specified index.default TomlTable
getTable(int index)
Get a table at a specified index.TomlPosition
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(java.lang.Appendable appendable, java.util.EnumSet<JsonOptions> options)
Append a JSON representation of this array to the appendable output.default void
toJson(java.lang.Appendable appendable, JsonOptions... options)
Append a JSON representation of this array to the appendable output.default java.lang.String
toJson(java.util.EnumSet<JsonOptions> options)
Return a representation of this array using JSON.default java.lang.String
toJson(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.String
toToml()
Return a representation of this array using TOML.default void
toToml(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()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
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
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
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.
-