Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.appengine.api.datastore
Class DataTypeTranslator

    java.lang.Object
      com.google.appengine.api.datastore.DataTypeTranslator

    public final class DataTypeTranslator

extends java.lang.Object

`DataTypeTranslator` is a utility class for converting between the data store's `Property` protocol buffers and the the user-facing classes (`String`, `User`, etc.).

Nested Class Summary
`static class` | `DataTypeTranslator.ComparableByteArray` A wrapper for a `byte[]` that implements `Comparable`.

Method Summary
`static void` | `addPropertiesToPb(java.util.Map<java.lang.String,java.lang.Object> map, EntityProto proto)` Add all of the properties in the specified map to an `EntityProto`.
`static void` | `extractImplicitPropertiesFromPb(EntityProto proto, java.util.Map<java.lang.String,java.lang.Object> map)` Copy all of the implicit properties present on `proto` into `map`.
`static void` | `extractIndexedPropertiesFromPb(EntityProto proto, java.util.Map<java.lang.String,java.lang.Object> map)` Copy all of the indexed properties present on `proto` into `map`.
`static void` | `extractPropertiesFromPb(EntityProto proto, java.util.Map<java.lang.String,java.lang.Object> map)` Copy all of the properties present on `proto` into `map`.
`static java.util.Collection<Property>` | `findIndexedPropertiesOnPb(EntityProto proto, java.lang.String propertyName)` Locates and returns all indexed properties with the given name on the given proto.
`static java.lang.Comparable<java.lang.Object>` | `getComparablePropertyValue(Property property)` Returns the value for the property as its comparable representation type.
`static java.lang.Object` | `getPropertyValue(Property property)` Returns the value for the property as its canonical type.
`static int` | `getTypeRank(java.lang.Class<? extends java.lang.Comparable> datastoreType)` Get the rank of the given datastore type relative to other datastore types.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### addPropertiesToPb

    public static void addPropertiesToPb(java.util.Map<java.lang.String,java.lang.Object> map,
                                         EntityProto proto)

  Add all of the properties in the specified map to an `EntityProto`. This involves determining the type of each property and creating the proper type-specific protocol buffer. If the property value is an `Entity.UnindexedValue`, or if it's a type that is never indexed, e.g. `Text` and `Blob`, it's added to `EntityProto.raw_property`. Otherwise it's added to `EntityProto.property`.

  Parameters:
    `map` - A not `null` map of all the properties which will be set on `proto`
    `proto` - A not `null` protocol buffer

### extractIndexedPropertiesFromPb

    public static void extractIndexedPropertiesFromPb(EntityProto proto,
                                                      java.util.Map<java.lang.String,java.lang.Object> map)

  Copy all of the indexed properties present on `proto` into `map`.

### extractPropertiesFromPb

    public static void extractPropertiesFromPb(EntityProto proto,
                                               java.util.Map<java.lang.String,java.lang.Object> map)

  Copy all of the properties present on `proto` into `map`.

### extractImplicitPropertiesFromPb

    public static void extractImplicitPropertiesFromPb(EntityProto proto,
                                                       java.util.Map<java.lang.String,java.lang.Object> map)

  Copy all of the implicit properties present on `proto` into `map`.

### findIndexedPropertiesOnPb

    public static java.util.Collection<Property> findIndexedPropertiesOnPb(EntityProto proto,
                                                                           java.lang.String propertyName)

  Locates and returns all indexed properties with the given name on the given proto.

### getPropertyValue

    public static java.lang.Object getPropertyValue(Property property)

  Returns the value for the property as its canonical type.

  Parameters:
    `property` - a not `null` property
  Returns:
    `null` if no value was set for `property`

### getComparablePropertyValue

    public static java.lang.Comparable<java.lang.Object> getComparablePropertyValue(Property property)

  Returns the value for the property as its comparable representation type.

  Parameters:
    `property` - a not `null` property
  Returns:
    `null` if no value was set for `property`

### getTypeRank

    public static int getTypeRank(java.lang.Class<? extends java.lang.Comparable> datastoreType)

  Get the rank of the given datastore type relative to other datastore types. Note that datastore types do not necessarily have unique ranks.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD