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

nats-io / nats.java / #2229

25 Sep 2025 09:14PM UTC coverage: 95.522% (+0.02%) from 95.506%
#2229

push

github

web-flow
Merge pull request #1436 from nats-io/persist_mode

Persist mode

21 of 22 new or added lines in 2 files covered. (95.45%)

12158 of 12728 relevant lines covered (95.52%)

0.96 hits per line

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

92.31
/src/main/java/io/nats/client/api/PersistMode.java
1
// Copyright 2020 The NATS Authors
2
// Licensed under the Apache License, Version 2.0 (the "License");
3
// you may not use this file except in compliance with the License.
4
// You may obtain a copy of the License at:
5
//
6
// http://www.apache.org/licenses/LICENSE-2.0
7
//
8
// Unless required by applicable law or agreed to in writing, software
9
// distributed under the License is distributed on an "AS IS" BASIS,
10
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
// See the License for the specific language governing permissions and
12
// limitations under the License.
13

14
package io.nats.client.api;
15

16
import org.jspecify.annotations.Nullable;
17

18
import java.util.HashMap;
19
import java.util.Map;
20

21
/**
22
 * Stream persist modes
23
 */
24
public enum PersistMode {
1✔
25
    Default("default"),
1✔
26
    Async("async");
1✔
27

28
    private final String mode;
29

30
    PersistMode(String mode) {
1✔
31
        this.mode = mode;
1✔
32
    }
1✔
33

34
    public String getMode() {
NEW
35
        return mode;
×
36
    }
37

38
    @Override
39
    public String toString() {
40
        return mode;
1✔
41
    }
42

43
    private static final Map<String, PersistMode> strEnumHash = new HashMap<>();
1✔
44

45
    static {
46
        for (PersistMode env : PersistMode.values()) {
1✔
47
            strEnumHash.put(env.toString(), env);
1✔
48
        }
49
    }
1✔
50

51
    @Nullable
52
    public static PersistMode get(String value) {
53
        return strEnumHash.get(value);
1✔
54
    }
55
}
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