Make the MongoDB docs better! We value your opinion. Share your feedback for a chance to win $100.
Click here >
Docs Menu
Docs Home
/ /
io.realm

Class DynamicRealmObject

java.lang.Object
io.realm.DynamicRealmObject

Class that wraps a normal RealmObject in order to allow dynamic access instead of a typed interface. Using a DynamicRealmObject is slower than using the regular RealmObject class.

Constructor and Description

Creates a dynamic Realm object based on an existing object.

Modificador y Tipo
Método y descripción

public booleano

public E

get <E >(
String fieldName
)

Returns the value for the given field.

public byte

String fieldName
)

Retorna el byte[] valor para un campo determinado.

public booleano

String fieldName
)

Returns the boolean value for a given field.

public byte

String fieldName
)

Returns the byte value for a given field.

public Date

String fieldName
)

Returns the Date value for a given field.

public Decimal128

String fieldName
)

Returns the Decimal128 value for a given field.

String fieldName,
java.lang.Class<E> primitiveType
)

Returns the RealmDictionary containing only primitive values.

String fieldName
)

Returns the RealmDictionary of DynamicRealmObject s being linked from the given field.

public double

String fieldName
)

Returns the double value for a given field.

Returns DynamicRealm instance where this DynamicRealmObject belongs.

public String

Returns the list of field names on this object.

String fieldName
)

Returns the type used by the underlying storage engine to represent this field.

public float

String fieldName
)

Returns the float value for a given field.

public int

String fieldName
)

Returns the int value for a given field.

public RealmList

getList <E >(
String fieldName,
java.lang.Class<E> primitiveType
)

Returns the RealmList containing only primitive values.

public RealmList

String fieldName
)

Devuelve la RealmList de DynamicRealmObject vinculados desde el campo proporcionado.

public long

String fieldName
)

Returns the long value for a given field.

String fieldName
)

Returns the object being linked to from this field.

public ObjectId

String fieldName
)

Returns the ObjectId value for a given field.

público RealmAny

String fieldName
)

Returns the RealmAny value for a given field.

public RealmSet

String fieldName,
java.lang.Class<E> primitiveType
)

Devuelve el RealmSet que contiene únicamente valores primitivos.

public RealmSet

String fieldName
)

Returns the RealmSet of DynamicRealmObject s being linked from the given field.

público short

String fieldName
)

Returns the short value for a given field.

public String

String fieldName
)

Returns the String value for a given field.

public String

Returns the type of object.

public UUID

String fieldName
)

Returns the UUID value for a given field.

public booleano

String fieldName
)

Checks whether an object has the given field or not.

public int

Returns a hash code value for the DynamicRealmObject object.

public booleano

String fieldName
)

Checks if the value of a given field is null .

String srcClassName,
String srcFieldName
)

Returns RealmResults containing all srcClassName class objects that have a relationship to this object from srcFieldName field.

public void

public ProxyState

public void

set (
String fieldName,
Object value
)

Establece el valor para el campo dado.

public void

String fieldName,
byte[] value
)

Sets the binary value of the given field.

public void

String fieldName,
boolean value
)

Establece el valor boolean del campo dado.

public void

String fieldName,
byte value
)

Establece el valor byte del campo dado.

public void

String fieldName,
Date value
)

Establece el valor Date del campo dado.

public void

String fieldName,
Decimal128 value
)

Establece el valor Decimal128 del campo dado.

public void

Sets the reference to a RealmDictionary on the given field.

public void

String fieldName,
double value
)

Establece el valor double del campo dado.

public void

String fieldName,
float value
)

Establece el valor float del campo dado.

public void

String fieldName,
int value
)

Establece el valor int del campo dado.

public void

setList <E >(
)

Establece la referencia a una RealmList en el campo dado.

public void

String fieldName,
long value
)

Establece el valor long del campo dado.

public void

String fieldName
)

Sets the value to null for the given field.

public void

Establece una referencia a otro objeto en el campo dado.

public void

String fieldName,
ObjectId value
)

Establece el valor ObjectId del campo dado.

public void

String fieldName,
RealmAny value
)

Establece el valor RealmAny del campo dado.

public void

Establece la referencia a un RealmSet en el campo dado.

public void

String fieldName,
short value
)

Establece el valor short del campo dado.

public void

String fieldName,
String value
)

Establece el valor String del campo dado.

public void

String fieldName,
UUID value
)

Establece el valor UUID del campo dado.

public String

  • Methods inherited from class java.lang.Object : getClass , hashCode , equals , clone , toString , notify , notifyAll , wait , wait , wait , finalize

  • Methods inherited from class io.realm.RealmObject : deleteFromRealm , deleteFromRealm , isValid , isValid , isFrozen , freeze , isFrozen , freeze , isLoaded , isLoaded , isManaged , isManaged , getRealm , getRealm , load , load , addChangeListener , addChangeListener , addChangeListener , addChangeListener , removeChangeListener , removeChangeListener , removeChangeListener , removeChangeListener , removeAllChangeListeners , removeAllChangeListeners , asFlowable , asChangesetObservable , asFlowable , asChangesetObservable

Creates a dynamic Realm object based on an existing object.

Parámetros

  • obj - the Realm object to convert to a dynamic object. Only objects managed by Realm can be used.

public boolean equals (
)

Anulaciones

equals en la clase Objeto

public E get <E >(
String fieldName
)

Returns the value for the given field.

Parámetros

  • fieldName - name of the field.

Devuelve

the field value.

Throws

public byte getBlob (
String fieldName
)

Returns the byte[] value for a given field.

Parámetros

  • fieldName - the name of the field.

Devuelve

the byte[] value.

Throws

public boolean getBoolean (
String fieldName
)

Returns the boolean value for a given field.

If the field is nullable, use isNull(String) to check for null instead of using this method.

Parámetros

  • fieldName - the name of the field.

Devuelve

the boolean value.

Throws

public byte getByte (
String fieldName
)

Returns the byte value for a given field.

If the field is nullable, use isNull(String) to check for null instead of using this method.

Parámetros

  • fieldName - the name of the field.

Devuelve

the byte value.

Throws

public Date getDate (
String fieldName
)

Returns the Date value for a given field.

Parámetros

  • fieldName - the name of the field.

Devuelve

the Date value.

Throws

public Decimal128 getDecimal128 (
String fieldName
)

Returns the Decimal128 value for a given field.

Parámetros

  • fieldName - the name of the field.

Devuelve

the Decimal128 value.

Throws

String fieldName,
java.lang.Class<E> primitiveType
)

Returns the RealmDictionary containing only primitive values.

If the dictionary contains references to other Realm objects, use getDictionary(String) instead.

Parámetros

  • fieldName - the name of the field.

  • primitiveType - the type of elements in the dictionary. Only primitive types are supported.

Devuelve

the RealmDictionary data for this field.

Throws

Returns the RealmDictionary of DynamicRealmObject s being linked from the given field.

Si el diccionario contiene tipos primitivos, usa en su lugar getDictionary(String, clase).

Parámetros

  • fieldName - the name of the field.

Devuelve

the RealmDictionary data for this field.

Throws

public double getDouble (
String fieldName
)

Returns the double value for a given field.

If the field is nullable, use isNull(String) to check for null instead of using this method.

Parámetros

  • fieldName - the name of the field.

Devuelve

the double value.

Throws

Returns DynamicRealm instance where this DynamicRealmObject belongs.

You must not call DynamicRealm.close() against returned instance.

Devuelve

DynamicRealm instance where this object belongs.

Throws

Returns the list of field names on this object.

Devuelve

list of field names on this objects or the empty list if the object doesn't have any fields.

Returns the type used by the underlying storage engine to represent this field.

Devuelve

tipo subyacente que utiliza Realm para representar este campo.

public float getFloat (
String fieldName
)

Returns the float value for a given field.

If the field is nullable, use isNull(String) to check for null instead of using this method.

Parámetros

  • fieldName - the name of the field.

Devuelve

the float value.

Throws

public int getInt (
String fieldName
)

Returns the int value for a given field.

If the field is nullable, use isNull(String) to check for null instead of using this method.

Parámetros

  • fieldName - the name of the field.

Devuelve

the int value. Integer values exceeding Integer.MAX_VALUE will wrap.

Throws

public RealmList getList <E >(
String fieldName,
java.lang.Class<E> primitiveType
)

Returns the RealmList containing only primitive values.

If the list contains references to other Realm objects, use getList(String) instead.

Parámetros

  • fieldName - the name of the field.

  • primitiveType - el tipo de elementos en la lista. Sólo se admiten tipos primitivos.

Devuelve

the RealmList data for this field.

Throws

String fieldName
)

Devuelve la RealmList de DynamicRealmObject vinculados desde el campo proporcionado.

If the list contains primitive types, use getList(String, Class) instead.

Parámetros

  • fieldName - the name of the field.

Devuelve

the RealmList data for this field.

Throws

public long getLong (
String fieldName
)

Returns the long value for a given field.

If the field is nullable, use isNull(String) to check for null instead of using this method.

Parámetros

  • fieldName - the name of the field.

Devuelve

the long value. Integer values exceeding Long.MAX_VALUE will wrap.

Throws

Returns the object being linked to from this field.

Parámetros

  • fieldName - the name of the field.

Devuelve

la representación DynamicRealmObject del objeto vinculado o null si no hay ningún objeto vinculado.

Throws

public ObjectId getObjectId (
String fieldName
)

Returns the ObjectId value for a given field.

Parámetros

  • fieldName - the name of the field.

Devuelve

el valor ObjectId.

Throws

String fieldName
)

Returns the RealmAny value for a given field.

Parámetros

  • fieldName - the name of the field.

Devuelve

the RealmAny value.

Throws

public RealmSet getRealmSet <E >(
String fieldName,
java.lang.Class<E> primitiveType
)

Devuelve el RealmSet que contiene únicamente valores primitivos.

If the set contains references to other Realm objects, use getRealmSet(String) instead.

Parámetros

  • fieldName - the name of the field.

  • primitiveType - el tipo de elementos en el conjunto. Sólo se admiten tipos primitivos.

Devuelve

the RealmSet data for this field.

Throws

String fieldName
)

Returns the RealmSet of DynamicRealmObject s being linked from the given field.

If the set contains primitive types, use getRealmSet(String, Class) instead.

Parámetros

  • fieldName - the name of the field.

Devuelve

the RealmSet data for this field.

Throws

public short getShort (
String fieldName
)

Returns the short value for a given field.

If the field is nullable, use isNull(String) to check for null instead of using this method.

Parámetros

  • fieldName - the name of the field.

Devuelve

the short value. Integer values exceeding Short.MAX_VALUE will wrap.

Throws

public String getString (
String fieldName
)

Returns the String value for a given field.

Parámetros

  • fieldName - the name of the field.

Devuelve

the String value.

Throws

public String getType ()

Returns the type of object. This will normally correspond to the name of a class that is extending RealmObject .

Devuelve

this objects type.

public UUID getUUID (
String fieldName
)

Returns the UUID value for a given field.

Parámetros

  • fieldName - the name of the field.

Devuelve

the UUID value.

Throws

public boolean hasField (
String fieldName
)

Checks whether an object has the given field or not.

Parámetros

  • fieldName - field name to check.

Devuelve

true if the object has a field with the given name, false otherwise.

public int hashCode ()

Returns a hash code value for the DynamicRealmObject object.

Según el contrato general de Object.hashCode() , cualquier dos objetos para los que equals devuelve true deben devolver el mismo valor de código hash.

Note that a RealmObject is a live object, and it might be updated by changes from other threads. This means that a hash code value of the object is not stable, and the value should be neither used as a key in HashMap nor saved in HashSet.

Devuelve

un valor de código hash para el objeto.

Anulaciones

hashCode en la clase Objeto

Tip

public boolean isNull (
String fieldName
)

Checks if the value of a given field is null .

Parámetros

  • fieldName - the name of the field.

Devuelve

true if field value is null, false otherwise.

Throws

String srcClassName,
String srcFieldName
)

Returns RealmResults containing all srcClassName class objects that have a relationship to this object from srcFieldName field.

An entry is added for each reference, e.g. if the same reference is in a list multiple times, the src object will show up here multiple times.

Parámetros

  • srcClassName - name of the class returned objects belong to.

  • srcFieldName - nombre del campo en la clase fuente que tiene una referencia a este objeto. El tipo de campo debe ser io.realm.RealmFieldType.OBJECT o io.realm.RealmFieldType.LIST .

Devuelve

el resultado.

Throws

  • IllegalArgumentException - if the srcClassName is null or does not exist, the srcFieldName is null or does not exist, type of the source field is not supported.

public void set (
String fieldName,
Object value
)

Sets the value for the given field. This method will automatically try to convert numbers and booleans that are given as String to their appropriate type. For example "10" will be converted to 10 if the field type is int .

Using the typed setters will be faster than using this method.

Throws

public void setBlob (
String fieldName,
byte[] value
)

Sets the binary value of the given field.

Parámetros

  • fieldName - field name.

  • value - value to insert.

Throws

public void setBoolean (
String fieldName,
boolean value
)

Establece el valor boolean del campo dado.

Parámetros

  • fieldName - field name to update.

  • value - value to insert.

Throws

public void setByte (
String fieldName,
byte value
)

Establece el valor byte del campo dado.

Parámetros

  • fieldName - field name.

  • value - value to insert.

Throws

public void setDate (
String fieldName,
Date value
)

Establece el valor Date del campo dado.

Parámetros

  • fieldName - field name.

  • value - value to insert.

Throws

public void setDecimal128 (
String fieldName,
Decimal128 value
)

Establece el valor Decimal128 del campo dado.

Parámetros

  • fieldName - field name.

  • value - value to insert.

Throws

public void setDictionary <E >(
String fieldName,
)

Sets the reference to a RealmDictionary on the given field.

This will copy all the elements in the dictionary into Realm, but any further changes to the dictionary will not be reflected in the Realm. Use getDictionary(String) in order to get a reference to the managed dictionary.

Parámetros

  • fieldName - field name.

  • dictionary Diccionario de objetos. Deben ser tipos primitivos o DynamicRealmObject.

Throws

  • IllegalArgumentException - if field name doesn't exist, it is not a dictionary field, the objects in the dictionary doesn't match the expected type or any Realm object in the dictionary belongs to a different Realm.

public void setDouble (
String fieldName,
double value
)

Establece el valor double del campo dado.

Parámetros

  • fieldName - field name.

  • value - value to insert.

Throws

public void setFloat (
String fieldName,
float value
)

Establece el valor float del campo dado.

Parámetros

  • fieldName - field name.

  • value - value to insert.

Throws

public void setInt (
String fieldName,
int value
)

Establece el valor int del campo dado.

Parámetros

  • fieldName - field name to update.

  • value - value to insert.

Throws

public void setList <E >(
)

Establece la referencia a una RealmList en el campo dado.

This will copy all the elements in the list into Realm, but any further changes to the list will not be reflected in the Realm. Use getList(String) in order to get a reference to the managed list.

Parámetros

  • fieldName - field name.

  • list - Lista de objetos. Deben ser tipos primitivos o DynamicRealmObject.

Throws

  • IllegalArgumentException - si el nombre del campo no existe, no es un campo de lista, los objetos de la lista no coinciden con el tipo esperado o algún objeto Realm de la lista pertenece a un Realm diferente.

public void setLong (
String fieldName,
long value
)

Establece el valor long del campo dado.

Parámetros

  • fieldName - field name.

  • value - value to insert.

Throws

public void setNull (
String fieldName
)

Sets the value to null for the given field.

Parámetros

  • fieldName - field name.

Throws

public void setObject (
String fieldName,
)

Establece una referencia a otro objeto en el campo dado.

Parámetros

  • fieldName - field name.

  • value - object to link to.

Throws

  • IllegalArgumentException - if field name doesn't exist, it doesn't link to other Realm objects, the type of DynamicRealmObject doesn't match or it belongs to a different Realm.

public void setObjectId (
String fieldName,
ObjectId value
)

Establece el valor ObjectId del campo dado.

Parámetros

  • fieldName - field name.

  • value - value to insert.

Throws

public void setRealmAny (
String fieldName,
RealmAny value
)

Establece el valor RealmAny del campo dado.

Parámetros

  • fieldName - field name.

  • value - value to insert.

Throws

public void setRealmSet <E >(
)

Establece la referencia a un RealmSet en el campo dado.

This will copy all the elements in the set into Realm, but any further changes to the set will not be reflected in the Realm. Use getRealmSet(String) in order to get a reference to the managed set.

Parámetros

  • fieldName - field name.

  • set - Conjunto de objetos. Deben ser tipos primitivos o DynamicRealmObject.

Throws

  • IllegalArgumentException - si el nombre del campo no existe, no es un campo configurado, los objetos del set no coinciden con el tipo esperado o cualquier objeto Realm del set pertenece a un Realm diferente.

public void setShort (
String fieldName,
short value
)

Establece el valor short del campo dado.

Parámetros

  • fieldName - field name.

  • value - value to insert.

Throws

public void setString (
String fieldName,
String value
)

Establece el valor String del campo dado.

Parámetros

  • fieldName - field name.

  • value - value to insert.

Throws

public void setUUID (
String fieldName,
UUID value
)

Establece el valor UUID del campo dado.

Parámetros

  • fieldName - field name.

  • value - value to insert.

Throws

public String toString ()

Anulaciones

toString en la clase Objeto

Volver

DynamicRealm.transacción.OnSuccess