Skip to content

Commit 755407e

Browse files
committedFeb 1, 2025·
Fixing test cases/ javadoc.
1 parent 90a10bd commit 755407e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed
 

‎src/main/java/org/meeuw/i18n/languages/ISO_639.java

+12-3
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,30 @@ public class ISO_639 {
2525
static ThreadLocal<Function<String, ISO_639_Code>> notFoundFallback = ThreadLocal.withInitial(() -> c -> NOTFOUND);
2626

2727
/**
28-
* If a code is not found in {@link #iso639(String)}, to throw {@link LanguageNotFoundException}, but return {@code null}
28+
* If a code is not found in {@link #iso639(String)}, do not throw {@link LanguageNotFoundException}, but return {@link LanguageCode#NOTFOUND}
29+
* @see #implicitUserDefine()
2930
*/
3031
public static RemoveIgnoreNotFound setIgnoreNotFound() {
31-
return setIgnoreNotFound(null);
32+
ignoreNotFound.set(Boolean.TRUE);
33+
notFoundFallback.remove();
34+
return RemoveIgnoreNotFound.INSTANCE;
3235
}
3336

3437
/**
35-
* If a code is not found in {@link #iso639(String)}, to throw {@link LanguageNotFoundException}, but produce use given function
38+
* If a code is not found in {@link #iso639(String)}, do not throw {@link LanguageNotFoundException}, but produce use given function
3639
* @param fallback What to produce in those cases
40+
* @since 3.8
3741
*/
3842
public static RemoveIgnoreNotFound setIgnoreNotFound(Function<String, ISO_639_Code> fallback) {
3943
ignoreNotFound.set(Boolean.TRUE);
4044
notFoundFallback.set(fallback);
4145
return RemoveIgnoreNotFound.INSTANCE;
4246
}
4347

48+
/**
49+
* If a code is not found in {@link #iso639(String)}, do not throw {@link LanguageNotFoundException}, but create {@link UserDefinedLanguage}
50+
* @since 3.8
51+
*/
4452
public static RemoveIgnoreNotFound implicitUserDefine() {
4553
ignoreNotFound.set(true);
4654
notFoundFallback.set(c -> new UserDefinedLanguage(c, null, c, "not found"));
@@ -239,6 +247,7 @@ public static Optional<ISO_639_Code> get(String code) {
239247
* @throws LanguageNotFoundException if not found, unless {@link ISO_639#setIgnoreNotFound()} was set, in which case {@link LanguageCode#NOTFOUND}
240248
* @see #setIgnoreNotFound()
241249
* @see #setIgnoreNotFound(Function)
250+
* @see #implicitUserDefine()
242251
*/
243252
public static ISO_639_Code iso639(String code) {
244253
if (ignoreNotFound.get()) {

0 commit comments

Comments
 (0)
Please sign in to comment.