Reputation: 872
I need to validate the user input from 2 TextBoxes first on client Side and later on server side. I createt a class called FieldVerifier
in the shared package.
I have 2 Methods to validate IBAN and BIC with iban4j:
public static boolean isValidIban(String iban) {
try {
IbanUtil.validate(iban, IbanFormat.Default);
} catch (Exception exc) {
return false;
}
return true;
}
public static boolean isValidBic(String bic) {
try {
BicUtil.validate(bic);
} catch (Exception exc) {
return false;
}
return true;
}
But if I try to start the application I get following error:
Line 91: No source code is available for type org.iban4j.IbanUtil; did you forget to inherit a required module?
Line 101: No source code is available for type org.iban4j.BicUtil; did you forget to inherit a required module?
Line 91: No source code is available for type org.iban4j.IbanFormat; did you forget to inherit a required module?
What do I need to do to build this library to use it on client side?
Upvotes: 1
Views: 661
Reputation: 3832
Just checked iban4j.
as wargre already mentioned, you have to do some work. iban4j can not be used with GWT without major changes.
You have to:
In this state the lib can not be used with GWT. There has to be done some major changes.
Update: I have ported iban4j to GWT: https://github.com/mvp4g/iban4g
Update 2:
iban4g has moved: https://github.com/NaluKit/iban4g and updated. This new version will work with Java, GWT and J2CL!
Upvotes: 1
Reputation: 4753
You set the the Validator class inside shared directory. So, the code for the Validator itself can be used in client side, but the dependencies (iban4j) need to be compatible with GWT also to be included on client side.
To do what you want, you have 2 choices.
Iban4j.gwt.xml
file) and include the module to your project - It means modify the current library or recompile it with your needUpvotes: 1