use of watson.yaml.MapValidatorNode in project watson by totemo.
the class Configuration method configureValidator.
// --------------------------------------------------------------------------
/**
* Perform lazy initialisation of the SnakeValidator used to validate in
* load().
*/
protected void configureValidator() {
if (_validator == null) {
_validator = new SnakeValidator();
MapValidatorNode root = new MapValidatorNode();
root.addChild("enabled", new TypeValidatorNode(Boolean.class, true, true));
root.addChild("debug", new TypeValidatorNode(Boolean.class, true, false));
root.addChild("auto_page", new TypeValidatorNode(Boolean.class, true, true));
root.addChild("region_info_timeout", new TypeValidatorNode(Double.class, true, 5.0));
root.addChild("vectors_shown", new TypeValidatorNode(Boolean.class, true, true));
root.addChild("billboard_background", new TypeValidatorNode(Integer.class, true, 0x7F000000));
root.addChild("billboard_foreground", new TypeValidatorNode(Integer.class, true, 0xFFFFFFFF));
// Default to true until we can distinguish server vs player gamemode.
root.addChild("group_ores_in_creative", new TypeValidatorNode(Boolean.class, true, true));
root.addChild("teleport_command", new TypeValidatorNode(String.class, true, "/tppos %g %d %g"));
root.addChild("chat_timeout", new TypeValidatorNode(Double.class, true, 0.1));
root.addChild("max_auto_pages", new TypeValidatorNode(Integer.class, true, 10));
root.addChild("pre_count", new TypeValidatorNode(Integer.class, true, 45));
root.addChild("post_count", new TypeValidatorNode(Integer.class, true, 45));
root.addChild("watson_prefix", new TypeValidatorNode(String.class, true, "w"));
root.addChild("ss_player_directory", new TypeValidatorNode(Boolean.class, true, true));
root.addChild("ss_player_suffix", new TypeValidatorNode(Boolean.class, true, true));
root.addChild("ss_date_directory", new TypeValidatorNode(String.class, true, ""));
root.addChild("reformat_query_results", new TypeValidatorNode(Boolean.class, true, true));
root.addChild("recolour_query_results", new TypeValidatorNode(Boolean.class, true, true));
root.addChild("time_ordered_deposits", new TypeValidatorNode(Boolean.class, true, false));
root.addChild("vector_length", new TypeValidatorNode(Double.class, true, 4.0));
for (Entry<String, ModifiedKeyBinding> entry : getKeyBindingsMap().entrySet()) {
root.addChild(entry.getKey(), new TypeValidatorNode(String.class, true, entry.getValue().toString()));
}
_validator.setRoot(root);
}
}
Aggregations