com.adgear.anoa.read.ProtobufReader Maven / Gradle / Ivy
package com.adgear.anoa.read;
import com.google.protobuf.Message;
import com.adgear.anoa.AnoaReflectionUtils;
class ProtobufReader extends AbstractRecordReader {
final private Message.Builder clearBuilderInstance;
ProtobufReader(Message.Builder builder) {
super(builder.clone().clear().getDescriptorForType().getFields().stream()
.map(field -> new ProtobufFieldWrapper(field, builder)));
this.clearBuilderInstance = builder.clone().clear();
}
ProtobufReader(Class recordClass) {
this((Message.Builder) AnoaReflectionUtils.getProtobufBuilder(recordClass));
}
@Override
protected RecordWrapper newWrappedInstance() {
return new ProtobufRecordWrapper<>(clearBuilderInstance);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy