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

trydofor / professional-wings / #125

31 Aug 2024 04:46AM UTC coverage: 63.579% (+0.7%) from 62.919%
#125

push

web-flow
Merge pull request #290 from trydofor/develop

3.2.130

1428 of 2191 new or added lines in 106 files covered. (65.18%)

41 existing lines in 24 files now uncovered.

12923 of 20326 relevant lines covered (63.58%)

0.64 hits per line

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

12.5
/wings/silencer-curse/src/main/java/pro/fessional/wings/silencer/notice/SmallNotice.java
1
package pro.fessional.wings.silencer.notice;
2

3
import org.jetbrains.annotations.Contract;
4
import org.jetbrains.annotations.NotNull;
5
import org.jetbrains.annotations.Nullable;
6

7
/**
8
 * Small and short messages, thread-safe.
9
 * encryption is required if the Conf contains any personal information, such as @AesString.
10
 *
11
 * @param <C> Configuration, generally message's from and to, etc., but not the contents.
12
 * @author trydofor
13
 * @since 2022-09-29
14
 */
15
public interface SmallNotice<C> {
16

17
    /**
18
     * get the default config
19
     */
20
    @NotNull
21
    C defaultConfig();
22

23
    /**
24
     * Build a new configuration with the `that` value as priority,
25
     * and use the default configuration if the `that` item is invalid.
26
     */
27
    @Contract("_->new")
28
    C combineConfig(@Nullable C that);
29

30
    /**
31
     * Provides different configurations depending on the name. combine with default when `combine`.
32
     * <code>conf == null ? defaultConfig() : combineConfig(conf)</code>
33
     */
34
    @Contract("_,true->new")
35
    C provideConfig(@Nullable String name, boolean combine);
36

37
    /**
38
     * Send synchronously with the default config, result in success or failure, or exception.
39
     * return false if both subject and content are null
40
     *
41
     * @param subject subject
42
     * @param content content
43
     * @return whether success
44
     */
45
    default boolean send(String subject, String content) {
UNCOV
46
        return send(defaultConfig(), subject, content);
×
47
    }
48

49
    /**
50
     * Send synchronously with the specified config by name, result in success or failure, or exception.
51
     * return false if both subject and content are null
52
     *
53
     * @param name    config's name, with combine=true
54
     * @param subject subject
55
     * @param content content
56
     * @return whether success
57
     */
58
    default boolean send(String name, String subject, String content) {
59
        return send(provideConfig(name, true), subject, content);
×
60
    }
61

62
    /**
63
     * Send synchronously with the specified config, result in success or failure, or exception.
64
     * return false if both subject and content are null
65
     *
66
     * @param config  config
67
     * @param subject subject
68
     * @param content content
69
     * @return whether success
70
     */
71
    boolean send(C config, String subject, String content);
72

73
    /**
74
     * Send synchronously with default configuration, fire and forget, no exceptions thrown.
75
     * return false if both subject and content are null
76
     *
77
     * @param subject subject
78
     * @param content content
79
     * @return whether success
80
     */
81
    default boolean post(String subject, String content) {
82
        return post(defaultConfig(), subject, content);
1✔
83
    }
84

85
    /**
86
     * Send synchronously with the specified config by name, fire and forget, no exceptions thrown.
87
     * return false if both subject and content are null
88
     *
89
     * @param name    config's name, with combine=true
90
     * @param subject subject
91
     * @param content content
92
     * @return whether success
93
     */
94
    default boolean post(String name, String subject, String content) {
95
        return post(provideConfig(name, true), subject, content);
×
96
    }
97

98
    /**
99
     * Send synchronously with the specified config, fire and forget, no exceptions thrown.
100
     * return false if both subject and content are null
101
     *
102
     * @param config  config, invalid item can be overridden by the default.
103
     * @param subject subject
104
     * @param content content
105
     * @return whether success
106
     */
107
    boolean post(C config, String subject, String content);
108

109
    /**
110
     * Send asynchronously with default configuration, fire and forget, no exceptions thrown.
111
     *
112
     * @param subject subject
113
     * @param content content
114
     */
115

116
    default void emit(String subject, String content) {
117
        emit(defaultConfig(), subject, content);
×
118
    }
×
119

120
    /**
121
     * Send asynchronously with the specified config by name, fire and forget, no exceptions thrown.
122
     *
123
     * @param name    config's name, with combine=true
124
     * @param subject subject
125
     * @param content content
126
     */
127
    default void emit(String name, String subject, String content) {
128
        emit(provideConfig(name, true), subject, content);
×
129
    }
×
130

131
    /**
132
     * Send asynchronously with the specified config by name, fire and forget, no exceptions thrown.
133
     *
134
     * @param config  config, invalid item can be overridden by the default.
135
     * @param subject subject
136
     * @param content content
137
     */
138
    void emit(C config, String subject, String content);
139
}
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

© 2025 Coveralls, Inc