Package example.avro
Class User
- java.lang.Object
-
- org.apache.avro.specific.SpecificRecordBase
-
- example.avro.User
-
- All Implemented Interfaces:
Externalizable
,Serializable
,Comparable<org.apache.avro.specific.SpecificRecord>
,org.apache.avro.generic.GenericContainer
,org.apache.avro.generic.GenericRecord
,org.apache.avro.generic.IndexedRecord
,org.apache.avro.specific.SpecificRecord
public class User extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
User.Builder
RecordBuilder for User instances.
-
Field Summary
Fields Modifier and Type Field Description static org.apache.avro.Schema
SCHEMA$
-
Constructor Summary
Constructors Constructor Description User()
Default constructor.User(CharSequence name, CharSequence favoriteNumber, CharSequence favoriteColor, EventType eventType)
All-args constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static org.apache.avro.message.BinaryMessageDecoder<User>
createDecoder(org.apache.avro.message.SchemaStore resolver)
Create a new BinaryMessageDecoder instance for this class that uses the specifiedSchemaStore
.void
customDecode(org.apache.avro.io.ResolvingDecoder in)
void
customEncode(org.apache.avro.io.Encoder out)
static User
fromByteBuffer(ByteBuffer b)
Deserializes a User from a ByteBuffer.Object
get(int field$)
static org.apache.avro.Schema
getClassSchema()
static org.apache.avro.message.BinaryMessageDecoder<User>
getDecoder()
Return the BinaryMessageDecoder instance used by this class.static org.apache.avro.message.BinaryMessageEncoder<User>
getEncoder()
Return the BinaryMessageEncoder instance used by this class.EventType
getEventType()
Gets the value of the 'eventType' field.CharSequence
getFavoriteColor()
Gets the value of the 'favoriteColor' field.CharSequence
getFavoriteNumber()
Gets the value of the 'favoriteNumber' field.CharSequence
getName()
Gets the value of the 'name' field.org.apache.avro.Schema
getSchema()
org.apache.avro.specific.SpecificData
getSpecificData()
protected boolean
hasCustomCoders()
static User.Builder
newBuilder()
Creates a new User RecordBuilder.static User.Builder
newBuilder(User other)
Creates a new User RecordBuilder by copying an existing User instance.static User.Builder
newBuilder(User.Builder other)
Creates a new User RecordBuilder by copying an existing Builder.void
put(int field$, Object value$)
void
readExternal(ObjectInput in)
void
setEventType(EventType value)
Sets the value of the 'eventType' field.void
setFavoriteColor(CharSequence value)
Sets the value of the 'favoriteColor' field.void
setFavoriteNumber(CharSequence value)
Sets the value of the 'favoriteNumber' field.void
setName(CharSequence value)
Sets the value of the 'name' field.ByteBuffer
toByteBuffer()
Serializes this User to a ByteBuffer.void
writeExternal(ObjectOutput out)
-
Methods inherited from class org.apache.avro.specific.SpecificRecordBase
compareTo, equals, get, getConversion, getConversion, hashCode, put, toString
-
-
-
-
Constructor Detail
-
User
public User()
Default constructor. Note that this does not initialize fields to their default values from the schema. If that is desired then one should usenewBuilder()
.
-
User
public User(CharSequence name, CharSequence favoriteNumber, CharSequence favoriteColor, EventType eventType)
All-args constructor.- Parameters:
name
- The new value for namefavoriteNumber
- The new value for favoriteNumberfavoriteColor
- The new value for favoriteColoreventType
- The new value for eventType
-
-
Method Detail
-
getClassSchema
public static org.apache.avro.Schema getClassSchema()
-
getEncoder
public static org.apache.avro.message.BinaryMessageEncoder<User> getEncoder()
Return the BinaryMessageEncoder instance used by this class.- Returns:
- the message encoder used by this class
-
getDecoder
public static org.apache.avro.message.BinaryMessageDecoder<User> getDecoder()
Return the BinaryMessageDecoder instance used by this class.- Returns:
- the message decoder used by this class
-
createDecoder
public static org.apache.avro.message.BinaryMessageDecoder<User> createDecoder(org.apache.avro.message.SchemaStore resolver)
Create a new BinaryMessageDecoder instance for this class that uses the specifiedSchemaStore
.- Parameters:
resolver
- aSchemaStore
used to find schemas by fingerprint- Returns:
- a BinaryMessageDecoder instance for this class backed by the given SchemaStore
-
toByteBuffer
public ByteBuffer toByteBuffer() throws IOException
Serializes this User to a ByteBuffer.- Returns:
- a buffer holding the serialized data for this instance
- Throws:
IOException
- if this instance could not be serialized
-
fromByteBuffer
public static User fromByteBuffer(ByteBuffer b) throws IOException
Deserializes a User from a ByteBuffer.- Parameters:
b
- a byte buffer holding serialized data for an instance of this class- Returns:
- a User instance decoded from the given buffer
- Throws:
IOException
- if the given bytes could not be deserialized into an instance of this class
-
getSpecificData
public org.apache.avro.specific.SpecificData getSpecificData()
- Overrides:
getSpecificData
in classorg.apache.avro.specific.SpecificRecordBase
-
getSchema
public org.apache.avro.Schema getSchema()
- Specified by:
getSchema
in interfaceorg.apache.avro.generic.GenericContainer
- Specified by:
getSchema
in classorg.apache.avro.specific.SpecificRecordBase
-
get
public Object get(int field$)
- Specified by:
get
in interfaceorg.apache.avro.generic.IndexedRecord
- Specified by:
get
in classorg.apache.avro.specific.SpecificRecordBase
-
put
public void put(int field$, Object value$)
- Specified by:
put
in interfaceorg.apache.avro.generic.IndexedRecord
- Specified by:
put
in classorg.apache.avro.specific.SpecificRecordBase
-
getName
public CharSequence getName()
Gets the value of the 'name' field.- Returns:
- The value of the 'name' field.
-
setName
public void setName(CharSequence value)
Sets the value of the 'name' field.- Parameters:
value
- the value to set.
-
getFavoriteNumber
public CharSequence getFavoriteNumber()
Gets the value of the 'favoriteNumber' field.- Returns:
- The value of the 'favoriteNumber' field.
-
setFavoriteNumber
public void setFavoriteNumber(CharSequence value)
Sets the value of the 'favoriteNumber' field.- Parameters:
value
- the value to set.
-
getFavoriteColor
public CharSequence getFavoriteColor()
Gets the value of the 'favoriteColor' field.- Returns:
- The value of the 'favoriteColor' field.
-
setFavoriteColor
public void setFavoriteColor(CharSequence value)
Sets the value of the 'favoriteColor' field.- Parameters:
value
- the value to set.
-
getEventType
public EventType getEventType()
Gets the value of the 'eventType' field.- Returns:
- The value of the 'eventType' field.
-
setEventType
public void setEventType(EventType value)
Sets the value of the 'eventType' field.- Parameters:
value
- the value to set.
-
newBuilder
public static User.Builder newBuilder()
Creates a new User RecordBuilder.- Returns:
- A new User RecordBuilder
-
newBuilder
public static User.Builder newBuilder(User.Builder other)
Creates a new User RecordBuilder by copying an existing Builder.- Parameters:
other
- The existing builder to copy.- Returns:
- A new User RecordBuilder
-
newBuilder
public static User.Builder newBuilder(User other)
Creates a new User RecordBuilder by copying an existing User instance.- Parameters:
other
- The existing instance to copy.- Returns:
- A new User RecordBuilder
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternal
in interfaceExternalizable
- Overrides:
writeExternal
in classorg.apache.avro.specific.SpecificRecordBase
- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException
- Specified by:
readExternal
in interfaceExternalizable
- Overrides:
readExternal
in classorg.apache.avro.specific.SpecificRecordBase
- Throws:
IOException
-
hasCustomCoders
protected boolean hasCustomCoders()
- Overrides:
hasCustomCoders
in classorg.apache.avro.specific.SpecificRecordBase
-
customEncode
public void customEncode(org.apache.avro.io.Encoder out) throws IOException
- Overrides:
customEncode
in classorg.apache.avro.specific.SpecificRecordBase
- Throws:
IOException
-
customDecode
public void customDecode(org.apache.avro.io.ResolvingDecoder in) throws IOException
- Overrides:
customDecode
in classorg.apache.avro.specific.SpecificRecordBase
- Throws:
IOException
-
-