类 DefaultImplementation


  • public class DefaultImplementation
    extends java.lang.Object
    Helper class for class instantiations and it also contains methods to work with schemas.
    • 构造器详细资料

      • DefaultImplementation

        public DefaultImplementation()
    • 方法详细资料

      • newClientBuilder

        public static ClientBuilder newClientBuilder()
      • newMessageId

        public static MessageId newMessageId​(long ledgerId,
                                             long entryId,
                                             int partitionIndex)
      • newMessageIdFromByteArray

        public static MessageId newMessageIdFromByteArray​(byte[] data)
      • newMessageIdFromByteArrayWithTopic

        public static MessageId newMessageIdFromByteArrayWithTopic​(byte[] data,
                                                                   java.lang.String topicName)
      • newAuthenticationToken

        public static Authentication newAuthenticationToken​(java.lang.String token)
      • newAuthenticationToken

        public static Authentication newAuthenticationToken​(java.util.function.Supplier<java.lang.String> supplier)
      • newAuthenticationTLS

        public static Authentication newAuthenticationTLS​(java.lang.String certFilePath,
                                                          java.lang.String keyFilePath)
      • newBytesSchema

        public static Schema<byte[]> newBytesSchema()
      • newStringSchema

        public static Schema<java.lang.String> newStringSchema()
      • newStringSchema

        public static Schema<java.lang.String> newStringSchema​(java.nio.charset.Charset charset)
      • newByteSchema

        public static Schema<java.lang.Byte> newByteSchema()
      • newShortSchema

        public static Schema<java.lang.Short> newShortSchema()
      • newIntSchema

        public static Schema<java.lang.Integer> newIntSchema()
      • newLongSchema

        public static Schema<java.lang.Long> newLongSchema()
      • newBooleanSchema

        public static Schema<java.lang.Boolean> newBooleanSchema()
      • newByteBufferSchema

        public static Schema<java.nio.ByteBuffer> newByteBufferSchema()
      • newFloatSchema

        public static Schema<java.lang.Float> newFloatSchema()
      • newDoubleSchema

        public static Schema<java.lang.Double> newDoubleSchema()
      • newDateSchema

        public static Schema<java.util.Date> newDateSchema()
      • newTimeSchema

        public static Schema<java.sql.Time> newTimeSchema()
      • newTimestampSchema

        public static Schema<java.sql.Timestamp> newTimestampSchema()
      • newInstantSchema

        public static Schema<java.time.Instant> newInstantSchema()
      • newLocalDateSchema

        public static Schema<java.time.LocalDate> newLocalDateSchema()
      • newLocalTimeSchema

        public static Schema<java.time.LocalTime> newLocalTimeSchema()
      • newLocalDateTimeSchema

        public static Schema<java.time.LocalDateTime> newLocalDateTimeSchema()
      • newProtobufSchema

        public static <T extends com.google.protobuf.GeneratedMessageV3> Schema<T> newProtobufSchema​(SchemaDefinition schemaDefinition)
      • newProtobufNativeSchema

        public static <T extends com.google.protobuf.GeneratedMessageV3> Schema<T> newProtobufNativeSchema​(SchemaDefinition schemaDefinition)
      • newAutoProduceSchema

        public static Schema<byte[]> newAutoProduceSchema()
      • newAutoProduceSchema

        public static Schema<byte[]> newAutoProduceSchema​(Schema<?> schema)
      • newKeyValueBytesSchema

        public static Schema<KeyValue<byte[],​byte[]>> newKeyValueBytesSchema()
      • newKeyValueSchema

        public static <K,​V> Schema<KeyValue<K,​V>> newKeyValueSchema​(Schema<K> keySchema,
                                                                                Schema<V> valueSchema)
      • newKeyValueSchema

        public static <K,​V> Schema<KeyValue<K,​V>> newKeyValueSchema​(java.lang.Class<K> key,
                                                                                java.lang.Class<V> value,
                                                                                SchemaType type)
      • newRecordSchemaBuilder

        public static RecordSchemaBuilder newRecordSchemaBuilder​(java.lang.String name)
      • decodeKeyValueEncodingType

        public static KeyValueEncodingType decodeKeyValueEncodingType​(SchemaInfo schemaInfo)
        Decode the kv encoding type from the schema info.
        参数:
        schemaInfo - the schema info
        返回:
        the kv encoding type
      • encodeKeyValueSchemaInfo

        public static <K,​V> SchemaInfo encodeKeyValueSchemaInfo​(Schema<K> keySchema,
                                                                      Schema<V> valueSchema,
                                                                      KeyValueEncodingType keyValueEncodingType)
        Encode key & value into schema into a KeyValue schema.
        参数:
        keySchema - the key schema
        valueSchema - the value schema
        keyValueEncodingType - the encoding type to encode and decode key value pair
        返回:
        the final schema info
      • encodeKeyValueSchemaInfo

        public static <K,​V> SchemaInfo encodeKeyValueSchemaInfo​(java.lang.String schemaName,
                                                                      Schema<K> keySchema,
                                                                      Schema<V> valueSchema,
                                                                      KeyValueEncodingType keyValueEncodingType)
        Encode key & value into schema into a KeyValue schema.
        参数:
        schemaName - the final schema name
        keySchema - the key schema
        valueSchema - the value schema
        keyValueEncodingType - the encoding type to encode and decode key value pair
        返回:
        the final schema info
      • decodeKeyValueSchemaInfo

        public static KeyValue<SchemaInfo,​SchemaInfo> decodeKeyValueSchemaInfo​(SchemaInfo schemaInfo)
        Decode the key/value schema info to get key schema info and value schema info.
        参数:
        schemaInfo - key/value schema info.
        返回:
        the pair of key schema info and value schema info
      • jsonifySchemaInfo

        public static java.lang.String jsonifySchemaInfo​(SchemaInfo schemaInfo)
        Jsonify the schema info.
        参数:
        schemaInfo - the schema info
        返回:
        the jsonified schema info
      • jsonifySchemaInfoWithVersion

        public static java.lang.String jsonifySchemaInfoWithVersion​(SchemaInfoWithVersion schemaInfoWithVersion)
        Jsonify the schema info with version.
        参数:
        schemaInfoWithVersion - the schema info with version
        返回:
        the jsonified schema info with version
      • jsonifyKeyValueSchemaInfo

        public static java.lang.String jsonifyKeyValueSchemaInfo​(KeyValue<SchemaInfo,​SchemaInfo> kvSchemaInfo)
        Jsonify the key/value schema info.
        参数:
        kvSchemaInfo - the key/value schema info
        返回:
        the jsonified schema info
      • convertKeyValueSchemaInfoDataToString

        public static java.lang.String convertKeyValueSchemaInfoDataToString​(KeyValue<SchemaInfo,​SchemaInfo> kvSchemaInfo)
        Convert the key/value schema data.
        参数:
        kvSchemaInfo - the key/value schema info
        返回:
        the convert key/value schema data string
      • convertKeyValueDataStringToSchemaInfoSchema

        public static byte[] convertKeyValueDataStringToSchemaInfoSchema​(byte[] keyValueSchemaInfoDataJsonBytes)
        Convert the key/value schema info data json bytes to key/value schema info data bytes.
        参数:
        keyValueSchemaInfoDataJsonBytes - the key/value schema info data json bytes
        返回:
        the key/value schema info data bytes
      • newDefaultBatcherBuilder

        public static BatcherBuilder newDefaultBatcherBuilder()
      • newKeyBasedBatcherBuilder

        public static BatcherBuilder newKeyBasedBatcherBuilder()
      • getBytes

        public static byte[] getBytes​(java.nio.ByteBuffer byteBuffer)
        Retrieves ByteBuffer data into byte[].
        参数:
        byteBuffer -
        返回:
      • newSchemaInfoImpl

        public SchemaInfo newSchemaInfoImpl​(java.lang.String name,
                                            byte[] schema,
                                            SchemaType type,
                                            java.util.Map<java.lang.String,​java.lang.String> propertiesValue)