Interface Tagged

    • Method Detail

      • setKeys

        void setKeys​(Map<String,​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

        Map<String,​StringgetKeys()
        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​(String key,
                 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

        String get​(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​(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​(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​(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​(String key,
                               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​(String key,
                               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​(String key,
                               Collection<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​(String key,
                                        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​(String key,
                                        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​(String key,
                                        Collection<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
      • keys

        default Stream<Stringkeys()
        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​(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​(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​(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​(Map<String,​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