Class GenericData (1.45.2)

public class GenericData extends AbstractMap<String,Object> implements Cloneable

Generic data that stores all unknown data key name/value pairs.

Subclasses can declare fields for known data keys using the Key annotation. Each field can be of any visibility (private, package private, protected, or public) and must not be static. null unknown data key names are not allowed, but null data values are allowed.

Iteration order of the data keys is based on the sorted (ascending) key names of the declared fields, followed by the iteration order of all of the unknown data key name/value pairs.

Implementation is not thread-safe. For a thread-safe choice instead use an implementation of ConcurrentMap.

Inheritance

Object > AbstractMap > GenericData

Implements

Cloneable

Constructors

GenericData()

public GenericData()

Constructs with case-insensitive keys.

GenericData(EnumSet<GenericData.Flags> flags)

public GenericData(EnumSet<GenericData.Flags> flags)
Parameter
Name Description
flags EnumSet<Flags>

flags that impact behavior of generic data

Methods

clone()

public GenericData clone()

Makes a "deep" clone of the generic data, in which the clone is completely independent of the original.

Returns
Type Description
GenericData
Overrides

entrySet()

public Set<Map.Entry<String,Object>> entrySet()
Returns
Type Description
Set<Entry<String,Object>>
Overrides

equals(Object o)

public boolean equals(Object o)
Parameter
Name Description
o Object
Returns
Type Description
boolean
Overrides

get(Object name)

public final Object get(Object name)
Parameter
Name Description
name Object
Returns
Type Description
Object
Overrides

getClassInfo()

public final ClassInfo getClassInfo()

Returns the class information.

Returns
Type Description
ClassInfo

getUnknownKeys()

public final Map<String,Object> getUnknownKeys()

Returns the map of unknown data key name to value.

Returns
Type Description
Map<String,Object>

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides

put(String fieldName, Object value)

public final Object put(String fieldName, Object value)
Parameters
Name Description
fieldName String
value Object
Returns
Type Description
Object
Overrides

putAll(Map<? extends String,?> map)

public final void putAll(Map<? extends String,?> map)
Parameter
Name Description
map Map<? extends java.lang.String,?>
Overrides

remove(Object name)

public final Object remove(Object name)
Parameter
Name Description
name Object
Returns
Type Description
Object
Overrides

set(String fieldName, Object value)

public GenericData set(String fieldName, Object value)

Sets the given field value (may be null) for the given field name. Any existing value for the field will be overwritten. It may be more slightly more efficient than #put(String, Object) because it avoids accessing the field's original value.

Overriding is only supported for the purpose of calling the super implementation and changing the return type, but nothing else.

Parameters
Name Description
fieldName String
value Object
Returns
Type Description
GenericData

setUnknownKeys(Map<String,Object> unknownFields)

public final void setUnknownKeys(Map<String,Object> unknownFields)

Sets the map of unknown data key name to value.

Parameter
Name Description
unknownFields Map<String,Object>

toString()

public String toString()
Returns
Type Description
String
Overrides