cn.wjybxx.btreecodec.branch.SelectorNCodec Maven / Gradle / Ivy
The newest version!
package cn.wjybxx.btreecodec.branch;
import cn.wjybxx.btree.Task;
import cn.wjybxx.btree.branch.SelectorN;
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 java.util.List;
import javax.annotation.Nonnull;
import javax.annotation.processing.Generated;
@SuppressWarnings({"unchecked", "rawtypes", "unused"})
@Generated("cn.wjybxx.dsonapt.CodecProcessor")
public final class SelectorNCodec 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_children = TypeInfo.of(List.class, Task.class);
public static final TypeInfo types_required = TypeInfo.of(int.class);
public static final TypeInfo types_failFast = TypeInfo.of(boolean.class);
public static final String names_guard = "guard";
public static final String names_flags = "flags";
public static final String names_children = "children";
public static final String names_required = "required";
public static final String names_failFast = "failFast";
@Override
@Nonnull
public Class getEncoderClass() {
return SelectorN.class;
}
@Override
public void writeFields(DsonObjectWriter writer, SelectorN 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_children, instance.getChildren(), types_children, null);
writer.writeInt(names_required, instance.getRequired(), WireType.VARINT, NumberStyle.SIMPLE);
writer.writeBoolean(names_failFast, instance.isFailFast());
}
@Override
protected SelectorN newInstance(DsonObjectReader reader, TypeInfo> typeInfo) {
return new SelectorN();
}
@Override
public void readFields(DsonObjectReader reader, SelectorN instance, TypeInfo> typeInfo) {
instance.setGuard(reader.readObject(names_guard, types_guard, null));
instance.setFlags(reader.readInt(names_flags));
instance.setChildren(reader.readObject(names_children, types_children, null));
instance.setRequired(reader.readInt(names_required));
instance.setFailFast(reader.readBoolean(names_failFast));
}
}