Class DynamicSchema

java.lang.Object
io.apicurio.registry.utils.protobuf.schema.DynamicSchema

public class DynamicSchema extends Object
  • Method Details

    • newBuilder

      public static DynamicSchema.Builder 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.DescriptorValidationException
      IOException
    • 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.DescriptorValidationException
      IOException
    • getFileDescriptorProto

      public com.google.protobuf.DescriptorProtos.FileDescriptorProto getFileDescriptorProto()
      Gets the protobuf file descriptor proto
      Returns:
      the file descriptor proto
    • newMessageBuilder

      public com.google.protobuf.DynamicMessage.Builder newMessageBuilder(String msgTypeName)
      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

      public com.google.protobuf.Descriptors.Descriptor getMessageDescriptor(String msgTypeName)
      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 name
      enumName - 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 name
      enumNumber - the enum number
      Returns:
      the enum value descriptor (null if not found)
    • getEnumDescriptor

      public com.google.protobuf.Descriptors.EnumDescriptor getEnumDescriptor(String enumTypeName)
      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

      public Set<String> getMessageTypes()
      Returns the message types registered with the schema
      Returns:
      the set of message type names
    • getEnumTypes

      public Set<String> 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

      public String toString()
      Returns a string representation of the schema
      Overrides:
      toString in class Object
      Returns:
      the schema string