Skip to content

Commit 4e787a8

Browse files
committed
fix: Only deprecate constructor of Translator and TranslatorOptions, not all methods
1 parent cee8123 commit 4e787a8

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

deepl-java/src/main/java/com/deepl/api/Translator.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@
1717
* Client for the DeepL API. To use the DeepL API, initialize an instance of this class using your
1818
* DeepL Authentication Key as found in your <a href="https://www.deepl.com/pro-account/">DeepL
1919
* account</a>.
20-
*
21-
* @deprecated Use {@link DeepLClient} instead.
2220
*/
23-
@Deprecated
2421
public class Translator {
2522
/** Base URL for DeepL API Free accounts. */
2623
private static final String DEEPL_SERVER_URL_FREE = "https://api-free.deepl.com";
@@ -40,7 +37,9 @@ public class Translator {
4037
* href="https://www.deepl.com/pro-account/">DeepL account</a>.
4138
* @param options Additional options controlling Translator behaviour.
4239
* @throws IllegalArgumentException If authKey is invalid.
40+
* @deprecated Use {@link DeepLClient} instead.
4341
*/
42+
@Deprecated
4443
public Translator(String authKey, TranslatorOptions options) throws IllegalArgumentException {
4544
if (authKey == null || authKey.length() == 0) {
4645
throw new IllegalArgumentException("authKey must be a non-empty string");
@@ -73,7 +72,9 @@ public Translator(String authKey, TranslatorOptions options) throws IllegalArgum
7372
* @param authKey DeepL Authentication Key as found in your <a
7473
* href="https://www.deepl.com/pro-account/">DeepL account</a>.
7574
* @throws IllegalArgumentException If authKey is invalid.
75+
* @deprecated Use {@link DeepLClient} instead.
7676
*/
77+
@Deprecated
7778
public Translator(String authKey) throws IllegalArgumentException {
7879
this(authKey, new TranslatorOptions());
7980
}

deepl-java/src/main/java/com/deepl/api/TranslatorOptions.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@
1717
* TranslatorOptions options = new TranslatorOptions()
1818
* .setTimeout(Duration.ofSeconds(1)).setMaxRetries(2);
1919
* </code>
20-
*
21-
* @deprecated Use {@link DeepLClientOptions} instead.
2220
*/
23-
@Deprecated
2421
public class TranslatorOptions {
2522
private int maxRetries = 5;
2623
private Duration timeout = Duration.ofSeconds(10);
@@ -30,6 +27,10 @@ public class TranslatorOptions {
3027
private boolean sendPlatformInfo = true;
3128
@Nullable private AppInfo appInfo = null;
3229

30+
/** @deprecated Use {@link DeepLClient} instead. */
31+
@Deprecated
32+
public TranslatorOptions() {}
33+
3334
/**
3435
* Set the maximum number of failed attempts that {@link Translator} will retry, per request. By
3536
* default, 5 retries are made. Note: only errors due to transient conditions are retried.

0 commit comments

Comments
 (0)