public class DbxList
extends java.lang.Object
DbxRecord
or DbxFields
, or might be a temporary list created by a
constructor and not saved in any field. If the list is located in a record (obtained by a
call to DbxRecord.getList(java.lang.String)
or DbxRecord.getOrCreateList(java.lang.String)
) or DbxFields
, the
DbxList
represents a direct view of the value of the field in place. DbxList
methods can be used to change the field, and any changes to the field will be immediately visible
(locally).
Changes to a list field through DbxList
methods will be automatically
merged with other changes made to the same field by combining the effective set of
put (set), insert (add), delete (remove), and move operations which result.
Lists are heterogeneous, able to hold elements of different types. List elements can
hold the same types as field values, with the exception of other lists. List elements
can't be null
. DbxList
elements are addressed by a 0-based index, like
a Java List
. The index at the end of the list can be used only when adding new
elements to the list.
Constructor and Description |
---|
DbxList()
Creates new empty
DbxList which can hold a list not yet
inserted into any records. |
DbxList(DbxList list)
Creates new
DbxList holding a list not yet inserted into any
records. |
Modifier and Type | Method and Description |
---|---|
DbxList |
add(boolean elem)
Adds the given
boolean value, appending it to the end of
the list. |
DbxList |
add(byte[] elem)
Adds the given byte value, appending it to the end of the list.
|
DbxList |
add(java.util.Date elem)
Adds the given
Date value, appending it to the end of the list. |
DbxList |
add(double elem)
Adds the given
double value, appending it to the end of
the list. |
DbxList |
add(int index,
boolean elem)
Adds the given
boolean value, inserting it at the given
index in the list. |
DbxList |
add(int index,
byte[] elem)
Adds the given byte value, inserting it at the given index in the list.
|
DbxList |
add(int index,
java.util.Date elem)
Adds the given
Date value, inserting it at the given index
in the list. |
DbxList |
add(int index,
double elem)
Adds the given
double value, inserting it at the given
index in the list. |
DbxList |
add(int index,
long elem)
Adds the given
long value, inserting it at the given
index in the list. |
DbxList |
add(int index,
java.lang.String elem)
Adds the given
String value, inserting it at the given
index in the list. |
DbxList |
add(long elem)
Adds the given
long value, appending it to the end of
the list. |
DbxList |
add(java.lang.String elem)
Adds the given
String value, appending it to the end of the list. |
void |
clear()
Deletes all elements from this list.
|
boolean |
equals(java.lang.Object o) |
boolean |
getBoolean(int index)
Returns the value of a
boolean element at the given index, which must
exist and be of the correct type. |
byte[] |
getBytes(int index)
Returns the value of a byte element at the given index, which must
exist and be of the correct type.
|
java.util.Date |
getDate(int index)
Returns the value of a
Date element at the given index, which must
exist and be of the correct type. |
double |
getDouble(int index)
Returns the value of a
double element at the given index, which must
exist and be of a numerical type. |
long |
getLong(int index)
Returns the value of a
long element at the given index, which must
exist and be of the correct type. |
java.lang.String |
getString(int index)
Returns the value of a
String element at the given index, which must
exist and be of the correct type. |
DbxFields.AtomType |
getType(int index)
Returns the type of the element at the given index.
|
int |
hashCode() |
boolean |
isEmpty()
Returns whether this list is empty.
|
DbxList |
move(int oldindex,
int newIndex)
Moves the element at
oldIndex (which must exist) to a
position such that its index in the modified list will be
newIndex . |
DbxList |
remove(int index)
Removes the element at the given index, which must exist.
|
DbxList |
set(int index,
boolean elem)
Replaces the element at the given index with a new
boolean value. |
DbxList |
set(int index,
byte[] elem)
Replaces the element at the given index with a new
String value.
|
DbxList |
set(int index,
java.util.Date elem)
Replaces the element at the given index with a new
Date value. |
DbxList |
set(int index,
double elem)
Replaces the element at the given index with a new
double value. |
DbxList |
set(int index,
long elem)
Replaces the element at the given index with a new
long value. |
DbxList |
set(int index,
java.lang.String elem)
Replaces the element at the given index with a new
String value. |
int |
size()
Returns the number of elements in this list.
|
java.lang.String |
toString() |
public DbxList()
DbxList
which can hold a list not yet
inserted into any records. Such an object can be used to repeatedly
set the same list in many fields or records.public DbxList(DbxList list)
DbxList
holding a list not yet inserted into any
records. The list is initialized with a copy of the contents of the
given list. Such an object can be used to repeatedly set the same
list in many fields or records.public boolean isEmpty()
public int size()
public void clear()
This operation will override any parallel changes rather than merging with them.
public DbxFields.AtomType getType(int index)
public boolean getBoolean(int index)
boolean
element at the given index, which must
exist and be of the correct type.public long getLong(int index)
long
element at the given index, which must
exist and be of the correct type. This method won't convert a
double
or boolean
field to a long
.public double getDouble(int index)
double
element at the given index, which must
exist and be of a numerical type. If the field value is a long
,
this method will silently convert it to a double
. No conversion
is performed on other field types.public java.lang.String getString(int index)
String
element at the given index, which must
exist and be of the correct type.public byte[] getBytes(int index)
public java.util.Date getDate(int index)
Date
element at the given index, which must
exist and be of the correct type.public DbxList add(boolean elem)
boolean
value, appending it to the end of
the list.
Returns a reference to this object, to allow for call chaining.
public DbxList add(long elem)
long
value, appending it to the end of
the list.
Returns a reference to this object, to allow for call chaining.
public DbxList add(double elem)
double
value, appending it to the end of
the list.
Returns a reference to this object, to allow for call chaining.
public DbxList add(java.lang.String elem)
String
value, appending it to the end of the list.
The value must not be null
.
Returns a reference to this object, to allow for call chaining.
public DbxList add(byte[] elem)
null
.
Returns a reference to this object, to allow for call chaining.
public DbxList add(java.util.Date elem)
Date
value, appending it to the end of the list.
The value must not be null
.
Returns a reference to this object, to allow for call chaining.
public DbxList add(int index, boolean elem)
boolean
value, inserting it at the given
index in the list.
Returns a reference to this object, to allow for call chaining.
public DbxList add(int index, long elem)
long
value, inserting it at the given
index in the list.
Returns a reference to this object, to allow for call chaining.
public DbxList add(int index, double elem)
double
value, inserting it at the given
index in the list.
Returns a reference to this object, to allow for call chaining.
public DbxList add(int index, java.lang.String elem)
String
value, inserting it at the given
index in the list. The value must not be null
.
Returns a reference to this object, to allow for call chaining.
public DbxList add(int index, byte[] elem)
null
.
Returns a reference to this object, to allow for call chaining.
public DbxList add(int index, java.util.Date elem)
Date
value, inserting it at the given index
in the list. The value must not be null
.
Returns a reference to this object, to allow for call chaining.
public DbxList set(int index, boolean elem)
boolean
value.
Returns a reference to this object, to allow for call chaining.
public DbxList set(int index, long elem)
long
value.
Returns a reference to this object, to allow for call chaining.
public DbxList set(int index, double elem)
double
value.
Returns a reference to this object, to allow for call chaining.
public DbxList set(int index, java.lang.String elem)
String
value. The value must not be null
.
Returns a reference to this object, to allow for call chaining.
public DbxList set(int index, byte[] elem)
null
.
Returns a reference to this object, to allow for call chaining.
public DbxList set(int index, java.util.Date elem)
Date
value. The value must not be null
.
Returns a reference to this object, to allow for call chaining.
public DbxList remove(int index)
Returns a reference to this object, to allow for call chaining.
public DbxList move(int oldindex, int newIndex)
oldIndex
(which must exist) to a
position such that its index in the modified list will be
newIndex
.
Returns a reference to this object, to allow for call chaining.
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object