All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.wjybxx.btreecodec.branch.FixedSwitchCodec Maven / Gradle / Ivy

There is a newer version: 1.3.0
Show newest version
package cn.wjybxx.btreecodec.branch;

import cn.wjybxx.btree.Task;
import cn.wjybxx.btree.branch.FixedSwitch;
import cn.wjybxx.btree.branch.SwitchHandler;
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 FixedSwitchCodec 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_handler = TypeInfo.of(SwitchHandler.class, Object.class);

    public static final TypeInfo types_branch1 = TypeInfo.of(Task.class, Object.class);

    public static final TypeInfo types_branch2 = TypeInfo.of(Task.class, Object.class);

    public static final TypeInfo types_branch3 = TypeInfo.of(Task.class, Object.class);

    public static final TypeInfo types_branch4 = TypeInfo.of(Task.class, Object.class);

    public static final TypeInfo types_branch5 = TypeInfo.of(Task.class, Object.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_handler = "handler";

    public static final String names_branch1 = "branch1";

    public static final String names_branch2 = "branch2";

    public static final String names_branch3 = "branch3";

    public static final String names_branch4 = "branch4";

    public static final String names_branch5 = "branch5";

    @Override
    @Nonnull
    public Class getEncoderClass() {
        return FixedSwitch.class;
    }

    @Override
    public void writeFields(DsonObjectWriter writer, FixedSwitch 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.writeObject(names_handler, instance.getHandler(), types_handler, null);
        writer.writeObject(names_branch1, instance.getBranch1(), types_branch1, null);
        writer.writeObject(names_branch2, instance.getBranch2(), types_branch2, null);
        writer.writeObject(names_branch3, instance.getBranch3(), types_branch3, null);
        writer.writeObject(names_branch4, instance.getBranch4(), types_branch4, null);
        writer.writeObject(names_branch5, instance.getBranch5(), types_branch5, null);
    }

    @Override
    protected FixedSwitch newInstance(DsonObjectReader reader, TypeInfo typeInfo) {
        return new FixedSwitch();
    }

    @Override
    public void readFields(DsonObjectReader reader, FixedSwitch 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.setHandler(reader.readObject(names_handler, types_handler, null));
        instance.setBranch1(reader.readObject(names_branch1, types_branch1, null));
        instance.setBranch2(reader.readObject(names_branch2, types_branch2, null));
        instance.setBranch3(reader.readObject(names_branch3, types_branch3, null));
        instance.setBranch4(reader.readObject(names_branch4, types_branch4, null));
        instance.setBranch5(reader.readObject(names_branch5, types_branch5, null));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy