Class 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 Summary

      Constructors 
      Constructor Description
      Metadata()
      Creates an instance of this class.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      CustomMetadataValue getCustomValue​(java.lang.String key)
      Obtains an instance of the CustomMetadataValue class associated with a given key.
      java.lang.Double getDouble​(java.lang.String key)
      Obtains a Double value associated with a given key.
      GeoCoordinates getGeoCoordinates​(java.lang.String key)
      Obtains a GeoCoordinates value associated with a given key.
      java.lang.Integer getInteger​(java.lang.String key)
      Obtains an Integer value associated with a given key.
      java.lang.String getString​(java.lang.String key)
      Obtains a String value associated with a given key.
      MetadataType getType​(java.lang.String key)
      Determines the type of a metadata value.
      void removeValue​(java.lang.String key)
      Removes a metadata key and its associated value.
      void setCustomValue​(java.lang.String key, CustomMetadataValue value)
      Creates a key:value pair, where the value is a type derived from CustomMetadataValue.
      void setDouble​(java.lang.String key, double value)
      Creates a key:value pair, where the value is of type Double.
      void setGeoCoordinates​(java.lang.String key, GeoCoordinates value)
      Creates a key:value pair, where the value is of type GeoCoordinates.
      void setInteger​(java.lang.String key, int value)
      Creates a key:value pair, where the value is of type Integer.
      void setString​(java.lang.String key, java.lang.String value)
      Creates a key:value pair, where the value is of type String.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Metadata

        public Metadata()

        Creates an instance of this class.

    • Method Detail

      • getCustomValue

        @Nullable
        public CustomMetadataValue getCustomValue​(@NonNull
                                                  java.lang.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 java.lang.Double getDouble​(@NonNull
                                          java.lang.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
                                                java.lang.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 java.lang.Integer getInteger​(@NonNull
                                            java.lang.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 java.lang.String getString​(@NonNull
                                          java.lang.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
                                    java.lang.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
                                java.lang.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
                                   java.lang.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
                              java.lang.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
                                      java.lang.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
                               java.lang.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
                              java.lang.String key,
                              @NonNull
                              java.lang.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.