Top Description Inners Fields Constructors Methods
org.apache.avro

public abstract Class JsonProperties

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.avro.Protocol, org.apache.avro.Protocol.Message, org.apache.avro.Schema, org.apache.avro.Schema.Field
Imports
java.util.AbstractSet, .Collections, .Iterator, .LinkedHashMap, .Map, .Map.Entry, .Queue, .Set, java.util.concurrent.ConcurrentHashMap, .ConcurrentLinkedQueue, .ConcurrentMap, java.io.IOException, org.apache.avro.util.internal.Accessor, .Accessor.JsonPropertiesAccessor, .JacksonUtils, org.apache.avro.util.MapEntry, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.JsonNode, com.fasterxml.jackson.databind.node.TextNode

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 java.lang.String
record Object java.util.Map
enum String java.lang.String
array Array java.util.Collection
map Object java.util.Map
fixed String byte[]
See Also
org.apache.avro.data.Json

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
public static final JsonProperties.Null
NULL_VALUE

A value representing a JSON null.

private ConcurrentMap<String, JsonNode>
private Set<String>

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
JsonProperties(Set<String> reserved, Map<String, ?> propMap)

Method Summary

Modifier and TypeMethod and Description
public void
addAllProps(JsonProperties properties)

Adds all the props from the specified json properties.

public void
addProp(String
The name of the property to add
name
,
String
The value for the property to add
value
)

Adds a property with the given name name and value value.

public void
addProp(String name, Object value)

private void
addProp(String
The name of the property to add
name
,
JsonNode
The value for the property to add
value
)

Adds a property with the given name name and value value.

private JsonNode
getJsonProp(String name)

Returns the value of the named property in this schema.

public Object
getObjectProp(String name)

Returns the value of the named property in this schema.

public Map<String, Object>
getObjectProps()

Return the defined properties as an unmodifiable Map.

public String
getProp(String name)

Returns the value of the named, string-valued property in this schema.

public boolean
pack-priv boolean
pack-priv int
public void
pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

NULL_VALUEback to summary
public static final JsonProperties.Null NULL_VALUE

A value representing a JSON null.

propsback to summary
private ConcurrentMap<String, JsonNode> props
reservedback to summary
private Set<String> reserved

Constructor Detail

JsonPropertiesback to summary
pack-priv JsonProperties(Set<String> reserved)
JsonPropertiesback to summary
pack-priv JsonProperties(Set<String> reserved, Map<String, ?> propMap)

Method Detail

addAllPropsback to summary
public void addAllProps(JsonProperties properties)

Adds all the props from the specified json properties.

See Also
getObjectProps()
addPropback to summary
public void addProp(String name, String value)

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:String

The name of the property to add

value:String

The value for the property to add

addPropback to summary
public void addProp(String name, Object value)
addPropback to summary
private void addProp(String name, JsonNode value)

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:String

The name of the property to add

value:JsonNode

The value for the property to add

getJsonPropback to summary
private JsonNode getJsonProp(String name)

Returns the value of the named property in this schema. Returns null if there is no property with that name.

getObjectPropback to summary
public Object getObjectProp(String name)

Returns the value of the named property in this schema. Returns null if there is no property with that name.

getObjectPropsback to summary
public Map<String, Object> getObjectProps()

Return the defined properties as an unmodifiable Map.

getPropback to summary
public String getProp(String name)

Returns the value of the named, string-valued property in this schema. Returns null if there is no string-valued property with that name.

hasPropsback to summary
public boolean hasProps()
propsEqualback to summary
pack-priv boolean propsEqual(JsonProperties np)
propsHashCodeback to summary
pack-priv int propsHashCode()
putAllback to summary
public void putAll(JsonProperties np)
writePropsback to summary
pack-priv void writeProps(JsonGenerator gen) throws IOException
org.apache.avro back to summary

public Class JsonProperties.Null

extends Object
Class Inheritance

Constructor Summary

AccessConstructor and Description
private
Null()

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Nullback to summary
private Null()