Package org.bitcoinj.utils
Class BaseTaggableObject
- java.lang.Object
-
- org.bitcoinj.utils.BaseTaggableObject
-
- All Implemented Interfaces:
TaggableObject
- Direct Known Subclasses:
Wallet
public class BaseTaggableObject extends java.lang.Object implements TaggableObject
A simple implementation ofTaggableObject
that uses a hashmap that is synchronized on this object's Java monitor.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,com.google.protobuf.ByteString>
tags
-
Constructor Summary
Constructors Constructor Description BaseTaggableObject()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.protobuf.ByteString
getTag(java.lang.String tag)
Returns the immutable byte array associated with the given tag name, or throwsIllegalArgumentException
if that tag wasn't set yet.java.util.Map<java.lang.String,com.google.protobuf.ByteString>
getTags()
Returns a copy of all the tags held by this object.com.google.protobuf.ByteString
maybeGetTag(java.lang.String tag)
Returns the immutable byte array associated with the given tag name, or null if there is none.void
setTag(java.lang.String tag, com.google.protobuf.ByteString value)
Associates the given immutable byte array with the string tag.
-
-
-
Method Detail
-
maybeGetTag
@Nullable public com.google.protobuf.ByteString maybeGetTag(java.lang.String tag)
Description copied from interface:TaggableObject
Returns the immutable byte array associated with the given tag name, or null if there is none.- Specified by:
maybeGetTag
in interfaceTaggableObject
-
getTag
public com.google.protobuf.ByteString getTag(java.lang.String tag)
Description copied from interface:TaggableObject
Returns the immutable byte array associated with the given tag name, or throwsIllegalArgumentException
if that tag wasn't set yet.- Specified by:
getTag
in interfaceTaggableObject
-
setTag
public void setTag(java.lang.String tag, com.google.protobuf.ByteString value)
Description copied from interface:TaggableObject
Associates the given immutable byte array with the string tag. See the docs for TaggableObject to learn more.- Specified by:
setTag
in interfaceTaggableObject
-
getTags
public java.util.Map<java.lang.String,com.google.protobuf.ByteString> getTags()
Description copied from interface:TaggableObject
Returns a copy of all the tags held by this object.- Specified by:
getTags
in interfaceTaggableObject
-
-