Interface Tagged

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int MAX_TAG_LENGTH
      The maximum tag length allowed by OSM API
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      java.lang.String get​(java.lang.String key)
      Replies the value of the given key; null, if there is no value for this key
      java.util.Map<java.lang.String,​java.lang.String> getKeys()
      Replies the map of key/value pairs.
      int getNumKeys()
      Gets the number of keys
      default boolean hasKey​(java.lang.String key)
      Replies true if there is a tag with key key.
      boolean hasKeys()
      Replies true, if there is at least one key/value pair; false, otherwise
      default boolean hasTag​(java.lang.String key)
      Replies true if there is a non-empty tag with key key.
      default boolean hasTag​(java.lang.String key, java.lang.String value)
      Tests whether this primitive contains a tag consisting of key and value.
      default boolean hasTag​(java.lang.String key, java.lang.String... values)
      Tests whether this primitive contains a tag consisting of key and any of values.
      default boolean hasTag​(java.lang.String key, java.util.Collection<java.lang.String> values)
      Tests whether this primitive contains a tag consisting of key and any of values.
      default boolean hasTagDifferent​(java.lang.String key, java.lang.String value)
      Tests whether this primitive contains a tag consisting of key and a value different from value.
      default boolean hasTagDifferent​(java.lang.String key, java.lang.String... values)
      Tests whether this primitive contains a tag consisting of key and none of values.
      default boolean hasTagDifferent​(java.lang.String key, java.util.Collection<java.lang.String> values)
      Tests whether this primitive contains a tag consisting of key and none of values.
      default boolean isKeyFalse​(java.lang.String key)
      Returns true if the key corresponds to an OSM false value.
      default boolean isKeyTrue​(java.lang.String key)
      Returns true if the key corresponds to an OSM true value.
      default java.util.stream.Stream<java.lang.String> keys()
      Replies the keys as stream
      java.util.Collection<java.lang.String> keySet()
      Replies the set of keys
      static Tagged ofMap​(java.util.Map<java.lang.String,​java.lang.String> tags)
      Returns a Tagged instance for the given tag map
      static Tagged ofTags​(java.util.Collection<Tag> tags)
      Returns a Tagged instance for the given tag collection
      void put​(java.lang.String key, java.lang.String value)
      Sets a key/value pairs
      default void put​(Tag tag)
      Sets a key/value pairs
      default void putAll​(java.util.Map<java.lang.String,​java.lang.String> tags)
      Add all key/value pairs.
      void remove​(java.lang.String key)
      Removes a given key/value pair
      void removeAll()
      Removes all tags
      void setKeys​(java.util.Map<java.lang.String,​java.lang.String> keys)
      Sets the map of key/value pairs
      default void visitKeys​(KeyValueVisitor visitor)
      Calls the visitor for every key/value pair.
    • Method Detail

      • setKeys

        void setKeys​(java.util.Map<java.lang.String,​java.lang.String> keys)
        Sets the map of key/value pairs
        Parameters:
        keys - the map of key value pairs. If null, reset to the empty map.
      • getKeys

        java.util.Map<java.lang.String,​java.lang.String> getKeys()
        Replies the map of key/value pairs. Never null, but may be the empty map.
        Returns:
        the map of key/value pairs
      • visitKeys

        default void visitKeys​(KeyValueVisitor visitor)
        Calls the visitor for every key/value pair.
        Parameters:
        visitor - The visitor to call.
        Since:
        13668
        See Also:
        getKeys()
      • put

        void put​(java.lang.String key,
                 java.lang.String value)
        Sets a key/value pairs
        Parameters:
        key - the key
        value - the value. If null, removes the key/value pair.
      • put

        default void put​(Tag tag)
        Sets a key/value pairs
        Parameters:
        tag - The tag to set.
        Since:
        10736
      • get

        java.lang.String get​(java.lang.String key)
        Replies the value of the given key; null, if there is no value for this key
        Parameters:
        key - the key
        Returns:
        the value
      • remove

        void remove​(java.lang.String key)
        Removes a given key/value pair
        Parameters:
        key - the key
      • hasKeys

        boolean hasKeys()
        Replies true, if there is at least one key/value pair; false, otherwise
        Returns:
        true, if there is at least one key/value pair; false, otherwise
      • hasKey

        default boolean hasKey​(java.lang.String key)
        Replies true if there is a tag with key key. The value could however be empty. See hasTag(String) to check for non-empty tags.
        Parameters:
        key - the key
        Returns:
        true, if there is a tag with key key
        Since:
        11608
        See Also:
        hasTag(String)
      • hasTag

        default boolean hasTag​(java.lang.String key)
        Replies true if there is a non-empty tag with key key.
        Parameters:
        key - the key
        Returns:
        true, if there is a non-empty tag with key key
        Since:
        13430
        See Also:
        hasKey(String)
      • hasTag

        default boolean hasTag​(java.lang.String key,
                               java.lang.String value)
        Tests whether this primitive contains a tag consisting of key and value.
        Parameters:
        key - the key forming the tag.
        value - value forming the tag.
        Returns:
        true if primitive contains a tag consisting of key and value.
        Since:
        13668
      • hasTag

        default boolean hasTag​(java.lang.String key,
                               java.lang.String... values)
        Tests whether this primitive contains a tag consisting of key and any of values.
        Parameters:
        key - the key forming the tag.
        values - one or many values forming the tag.
        Returns:
        true if primitive contains a tag consisting of key and any of values.
        Since:
        13668
      • hasTag

        default boolean hasTag​(java.lang.String key,
                               java.util.Collection<java.lang.String> values)
        Tests whether this primitive contains a tag consisting of key and any of values.
        Parameters:
        key - the key forming the tag.
        values - one or many values forming the tag.
        Returns:
        true if primitive contains a tag consisting of key and any of values.
        Since:
        13668
      • hasTagDifferent

        default boolean hasTagDifferent​(java.lang.String key,
                                        java.lang.String value)
        Tests whether this primitive contains a tag consisting of key and a value different from value.
        Parameters:
        key - the key forming the tag.
        value - value not forming the tag.
        Returns:
        true if primitive contains a tag consisting of key and a value different from value.
        Since:
        13668
      • hasTagDifferent

        default boolean hasTagDifferent​(java.lang.String key,
                                        java.lang.String... values)
        Tests whether this primitive contains a tag consisting of key and none of values.
        Parameters:
        key - the key forming the tag.
        values - one or many values forming the tag.
        Returns:
        true if primitive contains a tag consisting of key and none of values.
        Since:
        13668
      • hasTagDifferent

        default boolean hasTagDifferent​(java.lang.String key,
                                        java.util.Collection<java.lang.String> values)
        Tests whether this primitive contains a tag consisting of key and none of values.
        Parameters:
        key - the key forming the tag.
        values - one or many values forming the tag.
        Returns:
        true if primitive contains a tag consisting of key and none of values.
        Since:
        13668
      • keySet

        java.util.Collection<java.lang.String> keySet()
        Replies the set of keys
        Returns:
        the set of keys
        See Also:
        keys()
      • keys

        default java.util.stream.Stream<java.lang.String> keys()
        Replies the keys as stream
        Returns:
        the keys as stream
        Since:
        17584
        See Also:
        keySet()
      • getNumKeys

        int getNumKeys()
        Gets the number of keys
        Returns:
        The number of keys set for this tagged object.
        Since:
        13625
      • removeAll

        void removeAll()
        Removes all tags
      • isKeyTrue

        default boolean isKeyTrue​(java.lang.String key)
        Returns true if the key corresponds to an OSM true value.
        Parameters:
        key - OSM key
        Returns:
        true if the key corresponds to an OSM true value
        See Also:
        OsmUtils.isTrue(String)
      • isKeyFalse

        default boolean isKeyFalse​(java.lang.String key)
        Returns true if the key corresponds to an OSM false value.
        Parameters:
        key - OSM key
        Returns:
        true if the key corresponds to an OSM false value
        See Also:
        OsmUtils.isFalse(String)
      • ofTags

        static Tagged ofTags​(java.util.Collection<Tag> tags)
        Returns a Tagged instance for the given tag collection
        Parameters:
        tags - the tag collection
        Returns:
        a Tagged instance for the given tag collection
      • ofMap

        static Tagged ofMap​(java.util.Map<java.lang.String,​java.lang.String> tags)
        Returns a Tagged instance for the given tag map
        Parameters:
        tags - the tag map
        Returns:
        a Tagged instance for the given tag map