}
}
@SuppressWarnings("unchecked")
public static void generateValidationJsFile(String basePath) throws IOException {
FormSet formSet = null;
try {
java.lang.reflect.Field field = validatorResources.getClass().getDeclaredField(
"defaultFormSet");
field.setAccessible(true);
formSet = (FormSet) field.get(validatorResources);
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchFieldException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (formSet != null) {
Set<String> formNames = formSet.getForms().keySet();
for (String formName : formNames) {
File file = new File(basePath, formName + ".js");
String js = generateValidationJs(formName);
FileUtils.writeStringToFile(file, js);
}