Skip to content

Commit

Permalink
as you see, that is symmetrtical with the xml binding.
Browse files Browse the repository at this point in the history
  • Loading branch information
mihxil committed Jul 1, 2024
1 parent eb4e024 commit ec9506c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/meeuw/i18n/languages/ISO_639.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public static ISO_639_Code iso639(String code) {
* @since 3.3
*/
@JsonCreator
static @PolyNull ISO_639_Code lenientIso639(@PolyNull String code) {
public static @PolyNull ISO_639_Code lenientIso639(@PolyNull String code) {
if (code == null || code.isEmpty()) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
package org.meeuw.i18n.languages.jaxb;

import jakarta.xml.bind.annotation.adapters.XmlAdapter;
import org.meeuw.i18n.languages.*;
import static org.meeuw.i18n.languages.ISO_639.iso639;

import org.meeuw.i18n.languages.ISO_639_Code;

import static org.meeuw.i18n.languages.ISO_639.lenientIso639;

public class LanguageCodeAdapter extends XmlAdapter<String, ISO_639_Code> {
@Override
public ISO_639_Code unmarshal(String v) throws Exception {
if (v == null || v.isEmpty()) {
return null;
}
return iso639(v);
public ISO_639_Code unmarshal(String v) {
return lenientIso639(v);
}

@Override
public String marshal(ISO_639_Code v) throws Exception {
public String marshal(ISO_639_Code v) {
return v.code();
}
}

0 comments on commit ec9506c

Please sign in to comment.