- java.lang.Object
-
- org.redkale.convert.Convert<R,W>
-
- org.redkale.convert.BinaryConvert<ProtobufReader,ProtobufWriter>
-
- org.redkale.convert.pb.ProtobufConvert
-
public class ProtobufConvert extends BinaryConvert<ProtobufReader,ProtobufWriter>
protobuf的Convert实现
注意:
1、 只实现proto3版本
2、 int统一使用sint32, long统一使用sint64
3、 集合统一 packed repeated
4、 目前使用的基础数据类型为:bool、sint32、sint64、float、double、bytes、string、map、Any- 作者:
- zhangjx
-
-
字段概要
-
从类继承的字段 org.redkale.convert.Convert
factory, FEATURE_NULLABLE, FEATURE_TINY, features
-
-
构造器概要
构造器 限定符 构造器 说明 protected
ProtobufConvert(ConvertFactory<ProtobufReader,ProtobufWriter> factory, int features)
-
方法概要
-
从类继承的方法 org.redkale.convert.BinaryConvert
convertTo, isBinary
-
从类继承的方法 org.redkale.convert.Convert
convertTo, convertTo, convertToBytes, convertToBytes, convertToBytes, fieldFunc
-
-
-
-
构造器详细资料
-
ProtobufConvert
protected ProtobufConvert(ConvertFactory<ProtobufReader,ProtobufWriter> factory, int features)
-
-
方法详细资料
-
getFactory
public ProtobufFactory getFactory()
- 覆盖:
getFactory
在类中Convert<ProtobufReader,ProtobufWriter>
-
root
public static ProtobufConvert root()
-
newConvert
public ProtobufConvert newConvert(BiFunction<Attribute,Object,Object> objFieldFunc)
- 覆盖:
newConvert
在类中Convert<ProtobufReader,ProtobufWriter>
-
newConvert
public ProtobufConvert newConvert(BiFunction<Attribute,Object,Object> objFieldFunc, BiFunction mapFieldFunc)
- 覆盖:
newConvert
在类中Convert<ProtobufReader,ProtobufWriter>
-
newConvert
public ProtobufConvert newConvert(BiFunction<Attribute,Object,Object> objFieldFunc, Function<Object,ConvertField[]> objExtFunc)
- 覆盖:
newConvert
在类中Convert<ProtobufReader,ProtobufWriter>
-
newConvert
public ProtobufConvert newConvert(BiFunction<Attribute,Object,Object> fieldFunc, BiFunction mapFieldFunc, Function<Object,ConvertField[]> objExtFunc)
- 指定者:
newConvert
在类中Convert<ProtobufReader,ProtobufWriter>
-
pollReader
public ProtobufReader pollReader()
- 指定者:
pollReader
在类中Convert<ProtobufReader,ProtobufWriter>
-
offerReader
public void offerReader(ProtobufReader in)
- 指定者:
offerReader
在类中Convert<ProtobufReader,ProtobufWriter>
-
configWrite
protected <S extends ProtobufWriter> S configWrite(S writer)
- 覆盖:
configWrite
在类中Convert<ProtobufReader,ProtobufWriter>
-
pollProtobufWriter
public ProtobufByteBufferWriter pollProtobufWriter(Supplier<ByteBuffer> supplier)
-
pollProtobufWriter
public ProtobufWriter pollProtobufWriter(OutputStream out)
-
pollWriter
public ProtobufBytesWriter pollWriter()
- 指定者:
pollWriter
在类中Convert<ProtobufReader,ProtobufWriter>
-
offerWriter
public void offerWriter(ProtobufWriter out)
- 指定者:
offerWriter
在类中Convert<ProtobufReader,ProtobufWriter>
-
getJsonDecodeDescriptor
public String getJsonDecodeDescriptor(Type type)
请求参数的类型- 参数:
type
- 请求参数的类型- 返回:
- String
-
getJsonDecodeDescriptor
public String getJsonDecodeDescriptor(Type type, BiFunction<Type,DeMember,Boolean> func)
-
getJsonDecodeDescriptor
protected String getJsonDecodeDescriptor(Type parent, List<String> list, Type type, BiFunction<Type,DeMember,Boolean> func)
-
defineJsonDecodeDescriptor
protected void defineJsonDecodeDescriptor(Type parent, List<String> list, Type type, StringBuilder sb, String prefix, BiFunction<Type,DeMember,Boolean> excludeFunc)
-
getJsonEncodeDescriptor
public String getJsonEncodeDescriptor(Type type)
输出结果的类型- 参数:
type
- 输出结果的类型- 返回:
- String
-
getJsonEncodeDescriptor
public String getJsonEncodeDescriptor(Type type, BiFunction<Type,EnMember,Boolean> func)
-
getJsonEncodeDescriptor
protected String getJsonEncodeDescriptor(Type parent, List<String> list, Type type, BiFunction<Type,EnMember,Boolean> func)
-
defineJsonEncodeDescriptor
protected void defineJsonEncodeDescriptor(Type parent, List<String> list, Type type, StringBuilder sb, String prefix, BiFunction<Type,EnMember,Boolean> excludeFunc)
-
defineProtoDescriptor
protected String defineProtoDescriptor(Type parent, List<String> list, Type type, BiFunction<Type,EnMember,Boolean> func)
-
defineProtoDescriptor
protected void defineProtoDescriptor(Type parent, List<String> list, Type type, StringBuilder sb, String prefix, BiFunction<Type,EnMember,Boolean> excludeFunc)
-
defineTypeName
protected StringBuilder defineTypeName(Type type)
-
convertFrom
public <T> T convertFrom(Type type, byte[] bytes)
- 指定者:
convertFrom
在类中Convert<ProtobufReader,ProtobufWriter>
-
convertFrom
public <T> T convertFrom(Type type, byte[] bytes, int offset, int len)
- 指定者:
convertFrom
在类中Convert<ProtobufReader,ProtobufWriter>
-
convertFrom
public <T> T convertFrom(Type type, InputStream in)
-
convertFrom
public <T> T convertFrom(Type type, ByteBuffer... buffers)
- 指定者:
convertFrom
在类中Convert<ProtobufReader,ProtobufWriter>
-
convertFrom
public <T> T convertFrom(Type type, ProtobufReader reader)
- 指定者:
convertFrom
在类中Convert<ProtobufReader,ProtobufWriter>
-
convertTo
public byte[] convertTo(Type type, Object value)
- 指定者:
convertTo
在类中BinaryConvert<ProtobufReader,ProtobufWriter>
-
convertTo
public byte[] convertTo(Object value, int tag, byte... appends)
-
convertToBytes
public byte[] convertToBytes(Type type, Object value)
- 指定者:
convertToBytes
在类中Convert<ProtobufReader,ProtobufWriter>
-
convertToBytes
public void convertToBytes(Type type, Object value, ConvertBytesHandler handler)
- 指定者:
convertToBytes
在类中Convert<ProtobufReader,ProtobufWriter>
-
convertToBytes
public void convertToBytes(ByteArray array, Type type, Object value)
- 指定者:
convertToBytes
在类中Convert<ProtobufReader,ProtobufWriter>
-
convertTo
public void convertTo(OutputStream out, Type type, Object value)
-
convertTo
public ByteBuffer[] convertTo(Supplier<ByteBuffer> supplier, Type type, Object value)
- 指定者:
convertTo
在类中Convert<ProtobufReader,ProtobufWriter>
-
convertTo
public void convertTo(ProtobufWriter writer, Type type, Object value)
- 指定者:
convertTo
在类中Convert<ProtobufReader,ProtobufWriter>
-
convertToWriter
public ProtobufWriter convertToWriter(Type type, Object value)
-
-