本文整理汇总了Java中org.raml.parser.rule.ValidationResult类的典型用法代码示例。如果您正苦于以下问题:Java ValidationResult类的具体用法?Java ValidationResult怎么用?Java ValidationResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ValidationResult类属于org.raml.parser.rule包,在下文中一共展示了ValidationResult类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateRamlFile
import org.raml.parser.rule.ValidationResult; //导入依赖的package包/类
public static void validateRamlFile(File ramlFile) {
String location = ramlFile.getPath().replaceFirst(new File("").getAbsolutePath(), "").replaceFirst("^/", "");
List<ValidationResult> result = RamlValidationService.createDefault().validate(location);
if (result == null || result.isEmpty()) {
return;
}
StringBuilder message = new StringBuilder("Raml validation has found " + result.size() + " errors. See details:");
for (ValidationResult v : result) {
message
.append("\n")
.append(v.getLevel().name() + ": ")
.append(v.getMessage())
.append(" (" + ramlFile.getName() + ":" + v.getLine() + ")");
}
throw new RuntimeException(message.toString());
}
示例2: Generator
import org.raml.parser.rule.ValidationResult; //导入依赖的package包/类
private Generator(String aResourceLocation) throws GeneratorException {
super();
List<ValidationResult> results=validateRaml(aResourceLocation);
if (results.isEmpty()) {
root=parseRaml(aResourceLocation);
} else {
StringBuilder msg = new StringBuilder("Unexpected errors:\n ");
for (ValidationResult vr : results) {
msg.append("\t\t").append(vr.toString()).append("\n");
}
String oStrMsg=msg.toString();
logger.error(oStrMsg);
throw new GeneratorException(oStrMsg);
}
}
示例3: validateRaml
import org.raml.parser.rule.ValidationResult; //导入依赖的package包/类
public static List<ValidationResult> validateRaml(String resourceLocation)
{
return RamlValidationService.createDefault().validate(resourceLocation);
}