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

wz2cool / local-queue / #94

06 Jul 2025 07:25AM UTC coverage: 85.65% (-5.2%) from 90.82%
#94

push

wz2cool
add option

4 of 20 new or added lines in 4 files covered. (20.0%)

758 of 885 relevant lines covered (85.65%)

0.86 hits per line

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

0.0
/src/main/java/com/github/wz2cool/localqueue/model/message/MessageOption.java
1
package com.github.wz2cool.localqueue.model.message;
2

3
import java.util.*;
4

5
/**
6
 * 消息配置
7
 *
8
 * @author frank
9
 */
10
public class MessageOption {
×
11

12
    private Map<String, String> headers;
13

14
    /**
15
     * message tag
16
     */
17
    private String tag;
18
    /**
19
     * message key
20
     */
21
    private String messageKey;
22

23
    public String getTag() {
NEW
24
        return tag;
×
25
    }
26

27
    public void setTag(String tag) {
NEW
28
        this.tag = tag;
×
29
    }
×
30

31
    public String getMessageKey() {
32
        return messageKey;
×
33
    }
34

35
    public void setMessageKey(String messageKey) {
36
        this.messageKey = messageKey;
×
37
    }
×
38

39
    /**
40
     * add header
41
     *
42
     * @param key   header key
43
     * @param value header value
44
     */
45
    public synchronized void addHeader(String key, String value) {
46
        if (headers == null) {
×
47
            headers = new HashMap<>();
×
48
        }
49
        headers.put(key, value);
×
50
    }
×
51

52
    /**
53
     * 获取消息头
54
     *
55
     * @param headerKey header key
56
     * @return header value
57
     */
58
    public synchronized Optional<String> getHeaderValue(String headerKey) {
59
        if (Objects.isNull(headers)) {
×
60
            return Optional.empty();
×
61
        }
62
        return Optional.ofNullable(headers.get(headerKey));
×
63
    }
64

65
    /**
66
     * get header keys
67
     *
68
     * @return header keys
69
     */
70
    public synchronized Set<String> getHeaderKeys() {
71
        if (Objects.isNull(headers)) {
×
72
            return new HashSet<>();
×
73
        }
74
        return headers.keySet();
×
75
    }
76

77
    /**
78
     * check if has header
79
     *
80
     * @return true if has header
81
     */
82
    public synchronized boolean hasHeader() {
83
        if (Objects.isNull(headers)) {
×
84
            return false;
×
85
        }
86
        return !headers.isEmpty();
×
87
    }
88

89
    /**
90
     * get header keys
91
     *
92
     * @return header keys
93
     */
94
    public synchronized Map<String, String> getHeaders() {
95
        if (Objects.isNull(headers)) {
×
96
            return new HashMap<>();
×
97
        }
98
        return Collections.unmodifiableMap(headers);
×
99
    }
100
}
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