public final class Metadata
extends java.lang.Object
Constructor and Description |
---|
Metadata(int id,
MetaType metaType,
@Nullable java.lang.Object value)
Creates a new metadata instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
@Nullable java.lang.Object |
getValue() |
int |
hashCode() |
int |
id() |
MetaType |
metaType() |
void |
setId(int id) |
void |
setMetaType(MetaType metaType)
Sets the metadata type if compatible with the current value.
|
void |
setMetaTypeUnsafe(MetaType type)
Deprecated.
|
void |
setTypeAndValue(MetaType metaType,
@Nullable java.lang.Object value)
Sets metadata type and value.
|
void |
setValue(@Nullable java.lang.Object value)
Sets the metadata value if compatible with the current meta type.
|
java.lang.String |
toString() |
<T> T |
value() |
public Metadata(int id, MetaType metaType, @Nullable java.lang.Object value)
id
- metadata indexmetaType
- metadata typevalue
- value if presentjava.lang.IllegalArgumentException
- if the value and metaType are incompatiblepublic int id()
public void setId(int id)
public MetaType metaType()
public void setMetaType(MetaType metaType)
metaType
- metadata typejava.lang.IllegalArgumentException
- if the metadata type and current value are incompatiblesetTypeAndValue(MetaType, Object)
public <T> T value()
public @Nullable java.lang.Object getValue()
public void setValue(@Nullable java.lang.Object value)
value
- valuejava.lang.IllegalArgumentException
- if the value and current metaType are incompatiblesetTypeAndValue(MetaType, Object)
public void setTypeAndValue(MetaType metaType, @Nullable java.lang.Object value)
metaType
- metadata typevalue
- valuejava.lang.IllegalArgumentException
- if the value and metaType are incompatible@Deprecated public void setMetaTypeUnsafe(MetaType type)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object