![JAR search and dependency download from the Maven repository](/logo.png)
net.dongliu.prettypb.runtime.code.primitive.UInt32ProtoFieldInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of prettypb-runtime Show documentation
Show all versions of prettypb-runtime Show documentation
Prettypb serialization runtime
package net.dongliu.prettypb.runtime.code.primitive;
import net.dongliu.prettypb.runtime.code.ProtoBufReader;
import net.dongliu.prettypb.runtime.include.ProtoField;
import net.dongliu.prettypb.runtime.include.ProtoType;
import net.dongliu.prettypb.runtime.code.ProtoBufWriter;
import net.dongliu.prettypb.runtime.code.PrimitiveProtoFieldInfo;
import net.dongliu.prettypb.runtime.exception.IllegalDataException;
import java.io.IOException;
import java.lang.reflect.Field;
/**
* @author Dong Liu
*/
public class UInt32ProtoFieldInfo extends PrimitiveProtoFieldInfo {
public UInt32ProtoFieldInfo(Field field, Field helperField, ProtoField protoField) {
super(field, helperField, protoField);
}
@Override
protected void serializeFieldInternal(T bean, ProtoBufWriter protoBufWriter)
throws IllegalAccessException, IOException, IllegalDataException {
int value = field.getInt(bean);
protoBufWriter.encodeTag(ProtoType.UInt32, idx());
protoBufWriter.writeVarInt(value);
}
@Override
protected void deSerializeFieldInternal(T bean, ProtoBufReader protoBufReader)
throws IOException, IllegalAccessException {
int value = protoBufReader.readVarInt();
field.setInt(bean, value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy