Class GenericData
- Direct Known Subclasses:
GenericJson, GenericUrl, GenericXml, HttpHeaders, JsonRpcRequest
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.
- Since:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) final classIterator over the object data key/value map entries which iterates first over the fields and then over the unknown keys.(package private) final classSet of object data key/value map entries.static enumFlags that impact behavior of generic data.Nested classes/interfaces inherited from class AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs with case-insensitive keys.GenericData(EnumSet<GenericData.Flags> flags) -
Method Summary
Modifier and TypeMethodDescriptionclone()Makes a "deep" clone of the generic data, in which the clone is completely independent of the original.entrySet()booleanfinal Objectfinal ClassInfoReturns the class information.Returns the map of unknown data key name to value.inthashCode()final Objectfinal voidfinal ObjectSets the given field value (may benull) for the given field name.final voidsetUnknownKeys(Map<String, Object> unknownFields) Sets the map of unknown data key name to value.toString()Methods inherited from class AbstractMap
clear, containsKey, containsValue, isEmpty, keySet, size, valuesMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
unknownFields
-
classInfo
Class information.
-
-
Constructor Details
-
GenericData
public GenericData()Constructs with case-insensitive keys. -
GenericData
- Parameters:
flags- flags that impact behavior of generic data- Since:
- 1.10
-
-
Method Details
-
get
-
put
-
set
Sets the given field value (may benull) for the given field name. Any existing value for the field will be overwritten. It may be more slightly more efficient thanput(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.
-
putAll
-
remove
-
entrySet
-
clone
Makes a "deep" clone of the generic data, in which the clone is completely independent of the original.- Overrides:
clonein classAbstractMap<String,Object>
-
getUnknownKeys
-
setUnknownKeys
-
equals
-
hashCode
-
toString
- Overrides:
toStringin classAbstractMap<String,Object>
-
getClassInfo
-