public class DbxTable
extends java.lang.Object
DbxDatastore.getTable(String)
.
A table object is a convenience for querying and accessing records with a given table ID. The table in the datastore only exists based on the presence of records with its table ID, and a table doesn't enforce any schema on the fields of individual records.
Modifier and Type | Class and Description |
---|---|
static class |
DbxTable.IllegalTableId
Thrown when an illegal table ID is given.
|
class |
DbxTable.QueryResult
Represents the records returned by a query on a
DbxTable . |
static class |
DbxTable.ResolutionRule
Constants to specify the possible conflict resolution rules for a
field in
DbxTable.setResolutionRule(java.lang.String, com.dropbox.sync.android.DbxTable.ResolutionRule) . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object other) |
DbxRecord |
get(java.lang.String id)
Returns the record with the given ID, or
null if the record doesn't exist. |
DbxDatastore |
getDatastore()
Returns the
DbxDatastore that contains this table. |
java.lang.String |
getId()
Returns the ID of this table.
|
DbxRecord |
getOrInsert(java.lang.String id)
Returns the record with the given ID, or inserts a new record with the
given ID and no fields.
|
DbxRecord |
getOrInsert(java.lang.String id,
DbxFields fields)
Returns the record with the given ID, or inserts a new record with the
given ID and a copy of the given fields.
|
int |
hashCode() |
DbxRecord |
insert()
Inserts a new record with no fields, generating a new unique ID for the
resulting record.
|
DbxRecord |
insert(DbxFields fields)
Inserts a new record with a copy of the given the given field values, generating
a new unique ID.
|
static boolean |
isValidId(java.lang.String id)
Returns whether
id is a valid ID for a DbxTable . |
DbxTable.QueryResult |
query()
Returns all records in this table.
|
DbxTable.QueryResult |
query(DbxFields fields)
Queries for records that contain all of the given fields, with the
same values as the given object.
|
void |
setResolutionRule(java.lang.String fieldName,
DbxTable.ResolutionRule rule)
Set rule as the resolution pattern for conflicts involving the field
of the given name in all records in this table.
|
java.lang.String |
toString() |
public DbxDatastore getDatastore()
DbxDatastore
that contains this table.public java.lang.String getId()
public void setResolutionRule(java.lang.String fieldName, DbxTable.ResolutionRule rule)
DbxDatastore.sync()
or during a background upload.
Resolution rules aren't persistent. When you open a DbxDatastore
,
you should always set up any non-default resolution rules before you make any
changes to a given table. Any background conflict resolutions will use the rules
in force at the time the change was made, but new changes will use the default
rule unless you specify otherwise.
public DbxRecord get(java.lang.String id) throws DbxException
null
if the record doesn't exist.DbxException
- if there is a failure reading the saved state of this table.public DbxRecord getOrInsert(java.lang.String id) throws DbxException
DbxException
- if there is a failure reading or modifying the saved state of this table.public DbxRecord getOrInsert(java.lang.String id, DbxFields fields) throws DbxException
DbxException
- if there is a failure reading the saved state of this table.public DbxRecord insert()
public DbxRecord insert(DbxFields fields)
public DbxTable.QueryResult query() throws DbxException
DbxException
- if there is a failure reading the saved state of this table.public DbxTable.QueryResult query(DbxFields fields) throws DbxException
long
and
double
values by converting to double
, but will not compare
values of any other distinct types.DbxException
- if there is a failure reading the saved state of this table.public static boolean isValidId(java.lang.String id)
id
is a valid ID for a DbxTable
.
IDs are case-sensitive, can be 1-32 characters long and may contain
alphanumeric characters plus these punctuation characters: . - _ + / =
IDs with a leading colon (:) are also valid, but reserved for internal use.public boolean equals(java.lang.Object other)
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