Class Metadata

java.lang.Object
com.here.NativeBase
com.here.sdk.core.Metadata

public final class Metadata extends NativeBase

Holds metadata on behalf of a map item. An instance of this class can contain metadata items of varying types, such as String, Integer, Double, GeoCoordinates etc. and can also hold arbitrary metadata types by the use of the CustomMetadataValue interface.

  • Constructor Details

    • Metadata

      public Metadata()

      Creates an instance of this class.

  • Method Details

    • getCustomValue

      @Nullable public CustomMetadataValue getCustomValue(@NonNull String key)

      Obtains an instance of the CustomMetadataValue class associated with a given key.

      Parameters:
      key -

      The name of the key for which to obtain the value.

      Returns:

      The value associated with the key.

    • getDouble

      @Nullable public Double getDouble(@NonNull String key)

      Obtains a Double value associated with a given key.

      Parameters:
      key -

      The name of the key for which to obtain the value.

      Returns:

      The value associated with the key.

    • getGeoCoordinates

      @Nullable public GeoCoordinates getGeoCoordinates(@NonNull String key)

      Obtains a GeoCoordinates value associated with a given key.

      Parameters:
      key -

      The name of the key for which to obtain the value.

      Returns:

      The value associated with the key.

    • getInteger

      @Nullable public Integer getInteger(@NonNull String key)

      Obtains an Integer value associated with a given key.

      Parameters:
      key -

      The name of the key for which to obtain the value.

      Returns:

      The value associated with the key.

    • getString

      @Nullable public String getString(@NonNull String key)

      Obtains a String value associated with a given key.

      Parameters:
      key -

      The name of the key for which to obtain the value.

      Returns:

      The value associated with the key.

    • getType

      @Nullable public MetadataType getType(@NonNull String key)

      Determines the type of a metadata value. If the type of a metadata value associated with a key is not known, this method will enable the type to be queried, in order to know which get method to call. i.e. getDouble(), getInteger() etc.

      Parameters:
      key -

      The name of the key for which to obtain the type.

      Returns:

      An enumeration describing the type of the value associated with the key.

    • removeValue

      public void removeValue(@NonNull String key)

      Removes a metadata key and its associated value.

      Parameters:
      key -

      The name of the key to be removed.

    • setCustomValue

      public void setCustomValue(@NonNull String key, @NonNull CustomMetadataValue value)

      Creates a key:value pair, where the value is a type derived from CustomMetadataValue. If the given key already exists, its value will be replaced by the new one.

      Parameters:
      key -

      The name of the key to be created or replaced.

      value -

      The value to be assigned to the key.

    • setDouble

      public void setDouble(@NonNull String key, double value)

      Creates a key:value pair, where the value is of type Double. If the given key already exists, its value will be replaced by the new one.

      Parameters:
      key -

      The name of the key to be created or replaced.

      value -

      The value to be assigned to the key.

    • setGeoCoordinates

      public void setGeoCoordinates(@NonNull String key, @NonNull GeoCoordinates value)

      Creates a key:value pair, where the value is of type GeoCoordinates. If the given key already exists, its value will be replaced by the new one.

      Parameters:
      key -

      The name of the key to be created or replaced.

      value -

      The value to be assigned to the key.

    • setInteger

      public void setInteger(@NonNull String key, int value)

      Creates a key:value pair, where the value is of type Integer. If the given key already exists, its value will be replaced by the new one.

      Parameters:
      key -

      The name of the key to be created or replaced.

      value -

      The value to be assigned to the key.

    • setString

      public void setString(@NonNull String key, @NonNull String value)

      Creates a key:value pair, where the value is of type String. If the given key already exists, its value will be replaced by the new one.

      Parameters:
      key -

      The name of the key to be created or replaced.

      value -

      The value to be assigned to the key.