org.redkalex.convert.protobuf.ProtobufObjectEncoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of redkale-plugins Show documentation
Show all versions of redkale-plugins Show documentation
Redkale-Plugins -- java framework
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.redkalex.convert.protobuf;
import java.lang.reflect.Type;
import org.redkale.convert.*;
import org.redkale.util.Attribute;
/**
*
* @author zhangjx
*/
public class ProtobufObjectEncoder extends ObjectEncoder {
protected ProtobufObjectEncoder(Type type) {
super(type);
}
@Override
protected void initForEachEnMember(ConvertFactory factory, EnMember member) {
Attribute attr = member.getAttribute();
setTag(member, ProtobufFactory.getTag(attr.field(), attr.genericType(), member.getPosition(), ((ProtobufFactory) factory).enumtostring));
}
@Override
protected ProtobufWriter objectWriter(ProtobufWriter out, T value) {
if (out.count() > out.initoffset) return new ProtobufWriter(out).configFieldFunc(out);
return out;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy