Class DynamicSchema
java.lang.Object
com.github.os72.protobuf.dynamic.DynamicSchema
DynamicSchema
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptioncom.google.protobuf.Descriptors.EnumDescriptorgetEnumDescriptor(String enumTypeName) Gets the protobuf enum descriptor for the given enum typeReturns the enum types registered with the schemacom.google.protobuf.Descriptors.EnumValueDescriptorgetEnumValue(String enumTypeName, int enumNumber) Gets the enum value for the given enum type and numbercom.google.protobuf.Descriptors.EnumValueDescriptorgetEnumValue(String enumTypeName, String enumName) Gets the enum value for the given enum type and namecom.google.protobuf.DescriptorProtos.FileDescriptorSetReturns the internal file descriptor set of this schemacom.google.protobuf.Descriptors.DescriptorgetMessageDescriptor(String msgTypeName) Gets the protobuf message descriptor for the given message typeReturns the message types registered with the schemastatic DynamicSchema.BuilderCreates a new dynamic schema buildercom.google.protobuf.DynamicMessage.BuildernewMessageBuilder(String msgTypeName) Creates a new dynamic message builder for the given message typestatic DynamicSchemaparseFrom(byte[] schemaDescBuf) Parses a serialized schema descriptor (from byte array)static DynamicSchemaparseFrom(InputStream schemaDescIn) Parses a serialized schema descriptor (from input stream; closes the stream)byte[]Serializes the schematoString()Returns a string representation of the schema
-
Method Details
-
newBuilder
Creates a new dynamic schema builder- Returns:
- the schema builder
-
parseFrom
public static DynamicSchema parseFrom(InputStream schemaDescIn) throws com.google.protobuf.Descriptors.DescriptorValidationException, IOException Parses a serialized schema descriptor (from input stream; closes the stream)- Parameters:
schemaDescIn- the descriptor input stream- Returns:
- the schema object
- Throws:
com.google.protobuf.Descriptors.DescriptorValidationExceptionIOException
-
parseFrom
public static DynamicSchema parseFrom(byte[] schemaDescBuf) throws com.google.protobuf.Descriptors.DescriptorValidationException, IOException Parses a serialized schema descriptor (from byte array)- Parameters:
schemaDescBuf- the descriptor byte array- Returns:
- the schema object
- Throws:
com.google.protobuf.Descriptors.DescriptorValidationExceptionIOException
-
newMessageBuilder
Creates a new dynamic message builder for the given message type- Parameters:
msgTypeName- the message type name- Returns:
- the message builder (null if not found)
-
getMessageDescriptor
Gets the protobuf message descriptor for the given message type- Parameters:
msgTypeName- the message type name- Returns:
- the message descriptor (null if not found)
-
getEnumValue
-
getEnumValue
public com.google.protobuf.Descriptors.EnumValueDescriptor getEnumValue(String enumTypeName, int enumNumber) Gets the enum value for the given enum type and number- Parameters:
enumTypeName- the enum type nameenumNumber- the enum number- Returns:
- the enum value descriptor (null if not found)
-
getEnumDescriptor
Gets the protobuf enum descriptor for the given enum type- Parameters:
enumTypeName- the enum type name- Returns:
- the enum descriptor (null if not found)
-
getMessageTypes
-
getEnumTypes
-
getFileDescriptorSet
public com.google.protobuf.DescriptorProtos.FileDescriptorSet getFileDescriptorSet()Returns the internal file descriptor set of this schema- Returns:
- the file descriptor set
-
toByteArray
public byte[] toByteArray()Serializes the schema- Returns:
- the serialized schema descriptor
-
toString
-