Class GraphCodedInput
- All Implemented Interfaces:
GraphInput, Input, Schema<Object>
public final class GraphCodedInput
extends FilterInput<CodedInput>
implements GraphInput, Schema<Object>
A CodedInput w/c can handle cyclic dependencies when deserializing objects with graph transformations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate booleanFields inherited from class FilterInput
input -
Constructor Summary
ConstructorsConstructorDescriptionGraphCodedInput(CodedInput input) GraphCodedInput(CodedInput input, int initialCapacity) -
Method Summary
Modifier and TypeMethodDescriptiongetFieldName(int number) Gets the field name associated with the number.intgetFieldNumber(String name) Gets the field number associated with the name.<T> voidhandleUnknownField(int fieldNumber, Schema<T> schema) The underlying implementation should handle the unknown field.booleanReturns true if the last message was read as a reference.booleanisInitialized(Object owner) Returns true if there is no required field or if all the required fields are set.voidDeserializes a message/object from theinput.<T> TmergeObject(T value, Schema<T> schema) Merges an object(with schema) field value.Returns the full name of the message tied to this schema.Returns the simple name of the message tied to this schema.Creates the message/object tied to this schema.<T> intreadFieldNumber(Schema<T> schema) Reads the field number of a message/object tied to the givenschema.Gets the class of the message.voidupdateLast(Object morphedMessage, Object lastMessage) Updates the last reference (the tip/end of the index) kept if thelastMessagewas indeed the last message.voidSerializes a message/object to theoutput.Methods inherited from class FilterInput
readBool, readByteArray, readByteBuffer, readBytes, readBytes, readDouble, readEnum, readFixed32, readFixed64, readFloat, readInt32, readInt64, readSFixed32, readSFixed64, readSInt32, readSInt64, readString, readUInt32, readUInt64, transferByteRangeToMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Input
readBool, readByteArray, readByteBuffer, readBytes, readBytes, readDouble, readEnum, readFixed32, readFixed64, readFloat, readInt32, readInt64, readSFixed32, readSFixed64, readSInt32, readSInt64, readString, readUInt32, readUInt64, transferByteRangeTo
-
Field Details
-
references
-
lastRef
private int lastRef -
lastSchema
-
messageReference
private boolean messageReference
-
-
Constructor Details
-
GraphCodedInput
-
GraphCodedInput
-
-
Method Details
-
updateLast
Description copied from interface:GraphInputUpdates the last reference (the tip/end of the index) kept if thelastMessagewas indeed the last message.- Specified by:
updateLastin interfaceGraphInput
-
isCurrentMessageReference
public boolean isCurrentMessageReference()Description copied from interface:GraphInputReturns true if the last message was read as a reference.- Specified by:
isCurrentMessageReferencein interfaceGraphInput
-
readFieldNumber
Description copied from interface:InputReads the field number of a message/object tied to the givenschema.- Specified by:
readFieldNumberin interfaceInput- Overrides:
readFieldNumberin classFilterInput<CodedInput>- Throws:
IOException
-
mergeObject
Description copied from interface:InputMerges an object(with schema) field value. The providedschemahandles the deserialization for the object.- Specified by:
mergeObjectin interfaceInput- Overrides:
mergeObjectin classFilterInput<CodedInput>- Throws:
IOException
-
handleUnknownField
Description copied from interface:InputThe underlying implementation should handle the unknown field.- Specified by:
handleUnknownFieldin interfaceInput- Overrides:
handleUnknownFieldin classFilterInput<CodedInput>- Throws:
IOException
-
getFieldName
Description copied from interface:SchemaGets the field name associated with the number. This is particularly useful when serializing to different formats (Eg. JSON). When using numeric field names:return String.valueOf(number);
- Specified by:
getFieldNamein interfaceSchema<Object>
-
getFieldNumber
Description copied from interface:SchemaGets the field number associated with the name. This is particularly useful when serializing to different formats (Eg. JSON). When using numeric field names:return Integer.parseInt(name);
- Specified by:
getFieldNumberin interfaceSchema<Object>
-
isInitialized
Description copied from interface:SchemaReturns true if there is no required field or if all the required fields are set.- Specified by:
isInitializedin interfaceSchema<Object>
-
messageFullName
Description copied from interface:SchemaReturns the full name of the message tied to this schema. Allows custom schemas to provide a custom name other than typeClass().getName();- Specified by:
messageFullNamein interfaceSchema<Object>
-
messageName
Description copied from interface:SchemaReturns the simple name of the message tied to this schema. Allows custom schemas to provide a custom name other than typeClass().getSimpleName();- Specified by:
messageNamein interfaceSchema<Object>
-
newMessage
Description copied from interface:SchemaCreates the message/object tied to this schema.- Specified by:
newMessagein interfaceSchema<Object>
-
typeClass
-
mergeFrom
-
writeTo
-