@@ -24,10 +24,17 @@ public class ISO_639 {
24
24
static ThreadLocal <Boolean > ignoreNotFound = ThreadLocal .withInitial (() -> Boolean .FALSE );
25
25
static ThreadLocal <Function <String , ISO_639_Code >> notFoundFallback = ThreadLocal .withInitial (() -> c -> NOTFOUND );
26
26
27
+ /**
28
+ * If a code is not found in {@link #iso639(String)}, to throw {@link LanguageNotFoundException}, but return {@code null}
29
+ */
27
30
public static RemoveIgnoreNotFound setIgnoreNotFound () {
28
31
return setIgnoreNotFound (null );
29
32
}
30
33
34
+ /**
35
+ * If a code is not found in {@link #iso639(String)}, to throw {@link LanguageNotFoundException}, but produce use given function
36
+ * @param fallback What to produce in those cases
37
+ */
31
38
public static RemoveIgnoreNotFound setIgnoreNotFound (Function <String , ISO_639_Code > fallback ) {
32
39
ignoreNotFound .set (Boolean .TRUE );
33
40
notFoundFallback .set (fallback );
@@ -230,6 +237,8 @@ public static Optional<ISO_639_Code> get(String code) {
230
237
* @return The {@link ISO_639_3_Code} if found
231
238
* @param code ISO-639 code to find
232
239
* @throws LanguageNotFoundException if not found, unless {@link ISO_639#setIgnoreNotFound()} was set, in which case {@link LanguageCode#NOTFOUND}
240
+ * @see #setIgnoreNotFound()
241
+ * @see #setIgnoreNotFound(Function)
233
242
*/
234
243
public static ISO_639_Code iso639 (String code ) {
235
244
if (ignoreNotFound .get ()) {
0 commit comments