Package com.azure.data.tables.models
Class TableEntity
- java.lang.Object
-
- com.azure.data.tables.models.TableEntity
-
public final class TableEntity extends Object
An entity within a table. ATableEntitycan be used directly when interacting with the Tables service, with methods on theTableClientandTableAsyncClientclasses that accept and returnTableEntityinstances. After creating an instance, call theaddProperty(String, Object)orsetProperties(Map)methods to add properties to the entity. When retrieving an entity from the service, call thegetProperty(String)orgetProperties()methods to access the entity's properties.
-
-
Constructor Summary
Constructors Constructor Description TableEntity(String partitionKey, String rowKey)Construct a newTableEntity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TableEntityaddProperty(String key, Object value)Adds a single property to the entity's properties map.StringgetETag()Gets the entity's eTag.StringgetPartitionKey()Gets the entity's partition key.Map<String,Object>getProperties()Gets the map of the entity's properties.ObjectgetProperty(String key)Gets a single property from the entity's properties map.StringgetRowKey()Gets the entity's row key.OffsetDateTimegetTimestamp()Gets the entity's timestamp.TableEntitysetProperties(Map<String,Object> properties)Sets the contents of the provided map to the entity's properties map.
-
-
-
Method Detail
-
getProperty
public Object getProperty(String key)
Gets a single property from the entity's properties map. Only properties that have been added by callingaddProperty(String, Object)orsetProperties(Map)will be returned from this method.- Parameters:
key- Key for the property.- Returns:
- Value of the property.
- Throws:
NullPointerException- ifkeyis null.
-
getProperties
public Map<String,Object> getProperties()
Gets the map of the entity's properties. Only properties that have been added by callingaddProperty(String, Object)orsetProperties(Map)will be returned from this method.- Returns:
- A map of all properties representing this entity, including system properties.
-
addProperty
public TableEntity addProperty(String key, Object value)
Adds a single property to the entity's properties map.- Parameters:
key- Key for the property.value- Value of the property.- Returns:
- The updated
TableEntity. - Throws:
NullPointerException- ifkeyis null.
-
setProperties
public TableEntity setProperties(Map<String,Object> properties)
Sets the contents of the provided map to the entity's properties map.- Parameters:
properties- The map of properties to set.- Returns:
- The updated
TableEntity. - Throws:
NullPointerException- ifpropertiesis null.
-
getRowKey
public String getRowKey()
Gets the entity's row key.- Returns:
- The entity's row key.
-
getPartitionKey
public String getPartitionKey()
Gets the entity's partition key.- Returns:
- The entity's partition key.
-
getTimestamp
public OffsetDateTime getTimestamp()
Gets the entity's timestamp. The timestamp is automatically populated by the service. NewTableEntityinstances will not have a timestamp, but a timestamp will be present on anyTableEntityreturned from the service.- Returns:
- The entity's timestamp.
-
getETag
public String getETag()
Gets the entity's eTag. The eTag is automatically populated by the service. NewTableEntityinstances will not have an eTag, but an eTag will be present on anyTableEntityreturned from the service.- Returns:
- The entity's eTag.
-
-