Package org.apache.avro
Class JsonProperties
java.lang.Object
org.apache.avro.JsonProperties
- Direct Known Subclasses:
Protocol
,Protocol.Message
,Schema
,Schema.Field
Base class for objects that have JSON-valued properties. Avro and JSON values
are represented in Java using the following mapping:
Avro type | JSON type | Java type |
null |
null |
NULL_VALUE |
boolean |
Boolean | boolean |
int |
Number | int |
long |
Number | long |
float |
Number | float |
double |
Number | double |
bytes |
String | byte[] |
string |
String | String |
record |
Object | Map |
enum |
String | String |
array |
Array | Collection |
map |
Object | Map |
fixed |
String | byte[] |
- See Also:
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final JsonProperties.Null
A value representing a JSONnull
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAllProps
(JsonProperties properties) Adds all the props from the specified json properties.void
void
Adds a property with the given name name and value value.void
forEachProperty
(BiConsumer<String, Object> consumer) getObjectProp
(String name) Returns the value of the named property in this schema.getObjectProp
(String name, Object defaultValue) Return the defined properties as an unmodifiable Map.Returns the value of the named, string-valued property in this schema.boolean
hasProps()
boolean
propsContainsKey
(String key) void
putAll
(JsonProperties np)
-
Field Details
-
NULL_VALUE
A value representing a JSONnull
.
-
-
Method Details
-
getProp
Returns the value of the named, string-valued property in this schema. Returns null if there is no string-valued property with that name. -
getObjectProp
Returns the value of the named property in this schema. Returns null if there is no property with that name. -
getObjectProp
-
addProp
Adds a property with the given name name and value value. Neither name nor value can be null. It is illegal to add a property if another with the same name but different value already exists in this schema.- Parameters:
name
- The name of the property to addvalue
- The value for the property to add
-
addProp
-
putAll
-
addAllProps
Adds all the props from the specified json properties.- See Also:
-
getObjectProps
Return the defined properties as an unmodifiable Map. -
propsContainsKey
-
forEachProperty
-
hasProps
public boolean hasProps()
-