The
TableServiceEntity class represents the base object type for a table entity in the Storage service.
TableServiceEntity provides a base implementation for the
TableEntity interface that provides
readEntity
and
writeEntity
methods that by default serialize and deserialize all properties
via reflection. A table entity class may extend this class and override the
readEntity
and
writeEntity
methods to provide customized or more performant serialization logic.
The use of reflection allows subclasses of
TableServiceEntity to be serialized and deserialized without
having to implement the serialization code themselves. When both a getter method and setter method are found for a
given property name and data type, then the appropriate method is invoked automatically to serialize or deserialize
the data. To take advantage of the automatic serialization code, your table entity classes should provide getter and
setter methods for each property in the corresponding table entity in Microsoft Azure table storage. The reflection
code looks for getter and setter methods in pairs of the form
public type getPropertyName() { ... }
and
public void setPropertyName(type parameter) { ... }
where PropertyName is a property name for the table entity, and type is compatible with
the EDM data type of the property. See the table below for a map of property types to their language equivalents. The
StoreAs annotation may be applied with a name
attribute to specify a property name for
reflection on getter and setter methods that do not follow the property name convention. Method names and the
name
attribute of
StoreAs annotations are case sensitive for matching property names with
reflection. Use the
Ignore annotation to prevent methods from being used by reflection for automatic
serialization and deserialization. Note that the names "PartitionKey", "RowKey", "Timestamp", and "Etag" are reserved
and will be ignored if set with the
StoreAs annotation in a subclass.
The following table shows the supported property data types in Microsoft Azure storage and the corresponding Java
types when deserialized.
Storage Type |
EdmType Value |
Java Type |
Description |
Edm.Binary |
EdmType#BINARY |
byte[], Byte[] |
An array of bytes up to 64 KB in size. |
Edm.Boolean |
EdmType#BOOLEAN |
boolean, Boolean |
A Boolean value. |
Edm.DateTime |
EdmType#DATE_TIME |
java.util.Date |
A 64-bit value expressed as Coordinated Universal Time (UTC). The supported range begins from 12:00 midnight,
January 1, 1601 A.D. (C.E.), UTC. The range ends at December 31, 9999. |
Edm.Double |
EdmType#DOUBLE |
double, Double |
A 64-bit double-precision floating point value. |
Edm.Guid |
EdmType#GUID |
UUID |
A 128-bit globally unique identifier. |
Edm.Int32 |
EdmType#INT32 |
int, Integer |
A 32-bit integer value. |
Edm.Int64 |
EdmType#INT64 |
long, Long |
A 64-bit integer value. |
Edm.String |
EdmType#STRING |
String |
A UTF-16-encoded value. String values may be up to 64 KB in size. |
See the MSDN topic Understanding the Table Service
Data Model for an overview of tables, entities, and properties as used in the Microsoft Azure Storage service.
For an overview of the available EDM primitive data types and names, see the
Primitive Data Types section of
the OData Protocol Overview.