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

jreleaser / jreleaser / #460

25 Jan 2025 06:36PM UTC coverage: 50.047% (-0.3%) from 50.372%
#460

push

github

aalmiray
chore(announce): Annotate deprecated announcers

25196 of 50345 relevant lines covered (50.05%)

0.5 hits per line

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

0.0
/sdks/jreleaser-twitter-java-sdk/src/main/java/org/jreleaser/sdk/twitter/AbstractTwitterCommand.java
1
/*
2
 * SPDX-License-Identifier: Apache-2.0
3
 *
4
 * Copyright 2020-2025 The JReleaser authors.
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *     https://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
package org.jreleaser.sdk.twitter;
19

20
import org.jreleaser.logging.JReleaserLogger;
21

22
import static java.util.Objects.requireNonNull;
23
import static org.jreleaser.util.StringUtils.requireNonBlank;
24

25
/**
26
 * @author Andres Almiray
27
 * @since 0.1.0
28
 */
29
abstract class AbstractTwitterCommand implements TwitterCommand {
30
    protected final boolean dryrun;
31
    protected final Twitter twitter;
32

33
    protected AbstractTwitterCommand(JReleaserLogger logger,
34
                                     int connectTimeout,
35
                                     int readTimeout,
36
                                     String consumerKey,
37
                                     String consumerToken,
38
                                     String accessToken,
39
                                     String accessTokenSecret,
40
                                     boolean dryrun) {
×
41
        this.twitter = new Twitter(logger, connectTimeout, readTimeout, consumerKey, consumerToken, accessToken, accessTokenSecret, dryrun);
×
42
        this.dryrun = dryrun;
×
43
    }
×
44

45
    static class Builder<S extends Builder<S>> {
46
        protected final JReleaserLogger logger;
47
        protected boolean dryrun;
48
        protected String consumerKey;
49
        protected String consumerToken;
50
        protected String accessToken;
51
        protected String accessTokenSecret;
52
        protected int connectTimeout = 20;
×
53
        protected int readTimeout = 60;
×
54

55
        protected Builder(JReleaserLogger logger) {
×
56
            this.logger = requireNonNull(logger, "'logger' must not be null");
×
57
        }
×
58

59
        @SuppressWarnings("unchecked")
60
        protected final S self() {
61
            return (S) this;
×
62
        }
63

64
        public S dryrun(boolean dryrun) {
65
            this.dryrun = dryrun;
×
66
            return self();
×
67
        }
68

69
        public S consumerKey(String consumerKey) {
70
            this.consumerKey = requireNonBlank(consumerKey, "'consumerKey' must not be blank").trim();
×
71
            return self();
×
72
        }
73

74
        public S consumerToken(String consumerToken) {
75
            this.consumerToken = requireNonBlank(consumerToken, "'consumerToken' must not be blank").trim();
×
76
            return self();
×
77
        }
78

79
        public S accessToken(String accessToken) {
80
            this.accessToken = requireNonBlank(accessToken, "'accessToken' must not be blank").trim();
×
81
            return self();
×
82
        }
83

84
        public S accessTokenSecret(String accessTokenSecret) {
85
            this.accessTokenSecret = requireNonBlank(accessTokenSecret, "'accessTokenSecret' must not be blank").trim();
×
86
            return self();
×
87
        }
88

89
        public S connectTimeout(int connectTimeout) {
90
            this.connectTimeout = connectTimeout;
×
91
            return self();
×
92
        }
93

94
        public S readTimeout(int readTimeout) {
95
            this.readTimeout = readTimeout;
×
96
            return self();
×
97
        }
98

99
        protected void validate() {
100
            requireNonBlank(consumerKey, "'consumerKey' must not be blank");
×
101
            requireNonBlank(consumerToken, "'consumerToken' must not be blank");
×
102
            requireNonBlank(accessToken, "'accessToken' must not be blank");
×
103
            requireNonBlank(accessTokenSecret, "'accessTokenSecret' must not be blank");
×
104
        }
×
105
    }
106
}
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