cn.wjybxx.btreecodec.decorator.UntilSuccessCodec Maven / Gradle / Ivy
The newest version!
package cn.wjybxx.btreecodec.decorator;
import cn.wjybxx.btree.Task;
import cn.wjybxx.btree.decorator.UntilSuccess;
import cn.wjybxx.dson.WireType;
import cn.wjybxx.dson.text.NumberStyle;
import cn.wjybxx.dson.text.ObjectStyle;
import cn.wjybxx.dsoncodec.AbstractDsonCodec;
import cn.wjybxx.dsoncodec.DsonObjectReader;
import cn.wjybxx.dsoncodec.DsonObjectWriter;
import cn.wjybxx.dsoncodec.TypeInfo;
import javax.annotation.Nonnull;
import javax.annotation.processing.Generated;
@SuppressWarnings({"unchecked", "rawtypes", "unused"})
@Generated("cn.wjybxx.dsonapt.CodecProcessor")
public final class UntilSuccessCodec extends AbstractDsonCodec {
public static final TypeInfo types_guard = TypeInfo.of(Task.class, Object.class);
public static final TypeInfo types_flags = TypeInfo.of(int.class);
public static final TypeInfo types_child = TypeInfo.of(Task.class, Object.class);
public static final TypeInfo types_maxLoop = TypeInfo.of(int.class);
public static final String names_guard = "guard";
public static final String names_flags = "flags";
public static final String names_child = "child";
public static final String names_maxLoop = "maxLoop";
@Override
@Nonnull
public Class getEncoderClass() {
return UntilSuccess.class;
}
@Override
public void writeFields(DsonObjectWriter writer, UntilSuccess instance, TypeInfo> typeInfo,
ObjectStyle style) {
writer.writeObject(names_guard, instance.getGuard(), types_guard, null);
writer.writeInt(names_flags, instance.getFlags(), WireType.VARINT, NumberStyle.SIMPLE);
writer.writeObject(names_child, instance.getChild(), types_child, null);
writer.writeInt(names_maxLoop, instance.getMaxLoop(), WireType.VARINT, NumberStyle.SIMPLE);
}
@Override
protected UntilSuccess newInstance(DsonObjectReader reader, TypeInfo> typeInfo) {
return new UntilSuccess();
}
@Override
public void readFields(DsonObjectReader reader, UntilSuccess instance, TypeInfo> typeInfo) {
instance.setGuard(reader.readObject(names_guard, types_guard, null));
instance.setFlags(reader.readInt(names_flags));
instance.setChild(reader.readObject(names_child, types_child, null));
instance.setMaxLoop(reader.readInt(names_maxLoop));
}
}