Class DynamicSchema
java.lang.Object
io.apicurio.registry.utils.protobuf.schema.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.FileDescriptorProtoGets the protobuf file descriptor protocom.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
-
getFileDescriptorProto
public com.google.protobuf.DescriptorProtos.FileDescriptorProto getFileDescriptorProto()Gets the protobuf file descriptor proto- Returns:
- the file descriptor proto
-
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
public com.google.protobuf.Descriptors.EnumValueDescriptor getEnumValue(String enumTypeName, String enumName) Gets the enum value for the given enum type and name- Parameters:
enumTypeName- the enum type nameenumName- the enum name- Returns:
- the enum value descriptor (null if not found)
-
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
Returns the message types registered with the schema- Returns:
- the set of message type names
-
getEnumTypes
Returns the enum types registered with the schema- Returns:
- the set of enum type names
-
toByteArray
public byte[] toByteArray()Serializes the schema- Returns:
- the serialized schema descriptor
-
toString
Returns a string representation of the schema
-