001package org.anarres.qemu.qapi.api;
002
003import com.fasterxml.jackson.annotation.JsonIgnore;
004import com.fasterxml.jackson.annotation.JsonInclude;
005import com.fasterxml.jackson.annotation.JsonProperty;
006import com.fasterxml.jackson.annotation.JsonUnwrapped;
007import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
008import javax.annotation.CheckForNull;
009import javax.annotation.Nonnull;
010import org.anarres.qemu.qapi.common.*;
011
012/**
013 * Autogenerated class.
014 *
015 * <pre>QApiTypeDescriptor{name=BlockdevBackup, data={device=str, target=str, sync=MirrorSyncMode, *speed=int, *on-source-error=BlockdevOnError, *on-target-error=BlockdevOnError}, innerTypes=null}</pre>
016 */
017// QApiTypeDescriptor{name=BlockdevBackup, data={device=str, target=str, sync=MirrorSyncMode, *speed=int, *on-source-error=BlockdevOnError, *on-target-error=BlockdevOnError}, innerTypes=null}
018@JsonInclude(JsonInclude.Include.NON_EMPTY)
019public class BlockdevBackup extends QApiType {
020
021        @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
022        @JsonProperty("device")
023        @Nonnull
024        public java.lang.String device;
025        @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
026        @JsonProperty("target")
027        @Nonnull
028        public java.lang.String target;
029        @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
030        @JsonProperty("sync")
031        @Nonnull
032        public MirrorSyncMode sync;
033        @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
034        @JsonProperty("speed")
035        @CheckForNull
036        public java.lang.Long speed;
037        @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
038        @JsonProperty("on-source-error")
039        @CheckForNull
040        public BlockdevOnError onSourceError;
041        @SuppressFBWarnings("NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
042        @JsonProperty("on-target-error")
043        @CheckForNull
044        public BlockdevOnError onTargetError;
045
046        @Nonnull
047        public BlockdevBackup withDevice(java.lang.String value) {
048                this.device = value;
049                return this;
050        }
051
052        @Nonnull
053        public BlockdevBackup withTarget(java.lang.String value) {
054                this.target = value;
055                return this;
056        }
057
058        @Nonnull
059        public BlockdevBackup withSync(MirrorSyncMode value) {
060                this.sync = value;
061                return this;
062        }
063
064        @Nonnull
065        public BlockdevBackup withSpeed(java.lang.Long value) {
066                this.speed = value;
067                return this;
068        }
069
070        @Nonnull
071        public BlockdevBackup withOnSourceError(BlockdevOnError value) {
072                this.onSourceError = value;
073                return this;
074        }
075
076        @Nonnull
077        public BlockdevBackup withOnTargetError(BlockdevOnError value) {
078                this.onTargetError = value;
079                return this;
080        }
081
082        public BlockdevBackup() {
083        }
084
085        public BlockdevBackup(java.lang.String device, java.lang.String target, MirrorSyncMode sync, java.lang.Long speed, BlockdevOnError onSourceError, BlockdevOnError onTargetError) {
086                this.device = device;
087                this.target = target;
088                this.sync = sync;
089                this.speed = speed;
090                this.onSourceError = onSourceError;
091                this.onTargetError = onTargetError;
092        }
093
094        @JsonIgnore
095        @Override
096        public java.util.List<java.lang.String> getFieldNames() {
097                java.util.List<java.lang.String> names = super.getFieldNames();
098                names.add("device");
099                names.add("target");
100                names.add("sync");
101                names.add("speed");
102                names.add("on-source-error");
103                names.add("on-target-error");
104                return names;
105        }
106
107        @Override
108        public Object getFieldByName(@Nonnull java.lang.String name) throws NoSuchFieldException {
109                if ("device".equals(name))
110                        return device;
111                if ("target".equals(name))
112                        return target;
113                if ("sync".equals(name))
114                        return sync;
115                if ("speed".equals(name))
116                        return speed;
117                if ("on-source-error".equals(name))
118                        return onSourceError;
119                if ("on-target-error".equals(name))
120                        return onTargetError;
121                return super.getFieldByName(name);
122        }
123}