• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

leonchen83 / redis-replicator / #2567

11 Oct 2025 04:55AM UTC coverage: 72.231% (+0.03%) from 72.206%
#2567

push

chenby
redis-8.2

7244 of 10029 relevant lines covered (72.23%)

0.72 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

43.59
/src/main/java/com/moilioncircle/redis/replicator/cmd/impl/XAddCommand.java
1
/*
2
 * Copyright 2016-2018 Leon Chen
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package com.moilioncircle.redis.replicator.cmd.impl;
18

19
import java.util.Map;
20

21
import com.moilioncircle.redis.replicator.cmd.CommandSpec;
22

23
/**
24
 * @author Leon Chen
25
 * @since 2.6.0
26
 */
27
@CommandSpec(command = "XADD")
28
public class XAddCommand extends GenericKeyCommand {
29

30
    private static final long serialVersionUID = 1L;
31
    
32
    private DeletionPolicy policy;
33
    private MaxLen maxLen;
34
    private MinId minId;
35
    private Limit limit;
36
    private boolean nomkstream = false;
1✔
37
    private byte[] id;
38
    private Map<byte[], byte[]> fields;
39
    
40
    public XAddCommand() {
×
41
        
42
    }
×
43
    
44
    @Deprecated
45
    public XAddCommand(byte[] key, MaxLen maxLen, byte[] id, Map<byte[], byte[]> fields) {
46
        this(key, maxLen, false, id, fields);
×
47
    }
×
48
    
49
    /**
50
     * @param key key
51
     * @param maxLen maxlen
52
     * @param nomkstream nomkstream since redis 6.2-rc1
53
     * @param id id or *
54
     * @param fields fields
55
     * @since 3.5.0
56
     * @deprecated by {@link #XAddCommand(byte[], DeletionPolicy, MaxLen, MinId, Limit, boolean, byte[], Map)}
57
     */
58
    @Deprecated
59
    public XAddCommand(byte[] key, MaxLen maxLen, boolean nomkstream, byte[] id, Map<byte[], byte[]> fields) {
60
        this(key, maxLen, null, null, nomkstream, id, fields);
×
61
    }
×
62
    
63
    /**
64
     * @param key key
65
     * @param maxLen maxlen
66
     * @param minId minId
67
     * @param limit limit
68
     * @param nomkstream nomkstream since redis 6.2-rc2
69
     * @param id id or *
70
     * @param fields fields
71
     * @since 3.5.2
72
     * @deprecated by {@link #XAddCommand(byte[], MaxLen, MinId, Limit, boolean, byte[], Map)}
73
     */
74
    @Deprecated
75
    public XAddCommand(byte[] key, MaxLen maxLen, MinId minId, Limit limit, boolean nomkstream, byte[] id, Map<byte[], byte[]> fields) {
76
        this(key, null, maxLen, minId, limit, nomkstream, id, fields);
×
77
    }
×
78
    
79
    /**
80
     * @param key key
81
     * @param policy deletion policy since redis 8.2
82
     * @param maxLen maxlen
83
     * @param minId minId
84
     * @param limit limit
85
     * @param nomkstream nomkstream since redis 6.2-rc2
86
     * @param id id or *
87
     * @param fields fields
88
     * @since 3.10.0
89
     */
90
    public XAddCommand(byte[] key, DeletionPolicy policy, MaxLen maxLen, MinId minId, Limit limit, boolean nomkstream, byte[] id, Map<byte[], byte[]> fields) {
91
        super(key);
1✔
92
        this.policy = policy;
1✔
93
        this.maxLen = maxLen;
1✔
94
        this.minId = minId;
1✔
95
        this.limit = limit;
1✔
96
        this.nomkstream = nomkstream;
1✔
97
        this.id = id;
1✔
98
        this.fields = fields;
1✔
99
    }
1✔
100
    
101
    /**
102
     * @return policy
103
     * @since 3.10.0
104
     */
105
    public DeletionPolicy getPolicy() {
106
        return policy;
1✔
107
    }
108
    
109
    /**
110
     * @param policy policy
111
     * @since 3.10.0
112
     */
113
    public void setPolicy(DeletionPolicy policy) {
114
        this.policy = policy;
×
115
    }
×
116
    
117
    public MaxLen getMaxLen() {
118
        return maxLen;
1✔
119
    }
120
    
121
    public void setMaxLen(MaxLen maxLen) {
122
        this.maxLen = maxLen;
×
123
    }
×
124
    
125
    /**
126
     * @return min id
127
     * @since 3.5.2
128
     */
129
    public MinId getMinId() {
130
        return minId;
1✔
131
    }
132
    
133
    /**
134
     * @param minId minId
135
     * @since 3.5.2
136
     */
137
    public void setMinId(MinId minId) {
138
        this.minId = minId;
×
139
    }
×
140
    
141
    /**
142
     * @return limit
143
     * @since 3.5.2
144
     */
145
    public Limit getLimit() {
146
        return limit;
1✔
147
    }
148
    
149
    /**
150
     * @param limit limit
151
     * @since 3.5.2
152
     */
153
    public void setLimit(Limit limit) {
154
        this.limit = limit;
×
155
    }
×
156
    
157
    /**
158
     * @return nomkstream
159
     * @since 3.5.0
160
     */
161
    public boolean isNomkstream() {
162
        return nomkstream;
1✔
163
    }
164
    
165
    /**
166
     * @param nomkstream nomkstream since redis 6.2
167
     * @since 3.5.0
168
     */
169
    public void setNomkstream(boolean nomkstream) {
170
        this.nomkstream = nomkstream;
×
171
    }
×
172
    
173
    public byte[] getId() {
174
        return id;
1✔
175
    }
176
    
177
    public void setId(byte[] id) {
178
        this.id = id;
×
179
    }
×
180
    
181
    public Map<byte[], byte[]> getFields() {
182
        return fields;
1✔
183
    }
184

185
    public void setFields(Map<byte[], byte[]> fields) {
186
        this.fields = fields;
×
187
    }
×
188
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc