本文整理汇总了Java中com.github.fge.jackson.JsonLoader.fromFile方法的典型用法代码示例。如果您正苦于以下问题:Java JsonLoader.fromFile方法的具体用法?Java JsonLoader.fromFile怎么用?Java JsonLoader.fromFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.fge.jackson.JsonLoader
的用法示例。
在下文中一共展示了JsonLoader.fromFile方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkSchema
import com.github.fge.jackson.JsonLoader; //导入方法依赖的package包/类
private void checkSchema(File output)
{
try
{
JsonSchemaFactory factory = JsonSchemaFactory.byDefault();
URL schemaPath = getClass().getResource("/swagger-schema.json");
JsonSchema schema = factory.getJsonSchema(schemaPath.toString());
JsonNode json = JsonLoader.fromFile(output);
ProcessingReport report = schema.validate(json);
System.out.println(report);
}
catch (Exception e)
{
e.printStackTrace();
}
}
示例2: getSchema
import com.github.fge.jackson.JsonLoader; //导入方法依赖的package包/类
private JsonSchema getSchema() throws IOException, ProcessingException {
String fileName = String.format("%s/conf/schemas/%s.json",
env.rootPath().getAbsolutePath(), configuration.schema());
JsonNode schemaNode = JsonLoader.fromFile(new File(fileName));
JsonSchemaFactory factory = JsonSchemaFactory.byDefault();
return factory.getJsonSchema(schemaNode);
}
示例3: validate
import com.github.fge.jackson.JsonLoader; //导入方法依赖的package包/类
public void validate(File ConfigurationFile) throws IOException, ProcessingException, IllegalSchemaException {
JsonNode Configuration = JsonLoader.fromFile(ConfigurationFile);
ProcessingReport r1 = VALIDATOR.validate(
ConfigurationSchema,
Configuration
);
if (!r1.isSuccess()) {
Iterator<ProcessingMessage> it = r1.iterator();
ProcessingMessage pm = it.next();
JSONObject o = new JSONObject(pm.asJson().toString());
throw new IllegalSchemaException(o.toString(4));
}
}
示例4: validate
import com.github.fge.jackson.JsonLoader; //导入方法依赖的package包/类
@Override
public final ValidationResult validate(File file) throws IOException {
JsonNode jsonNode = JsonLoader.fromFile(file);
return getValidationResult(jsonNode);
}
示例5: getJsonNode
import com.github.fge.jackson.JsonLoader; //导入方法依赖的package包/类
public static JsonNode getJsonNode(File jsonFile)
throws IOException
{
return JsonLoader.fromFile(jsonFile);
}
示例6: ConfigurationValidator
import com.github.fge.jackson.JsonLoader; //导入方法依赖的package包/类
public ConfigurationValidator(String path) throws IOException {
this.VALIDATOR = JsonSchemaFactory.byDefault().getValidator();
this.ConfigurationSchema = JsonLoader.fromFile(
new File(path + "/ConfigurationSchema.json")
);
}
示例7: setConfigurationSchema
import com.github.fge.jackson.JsonLoader; //导入方法依赖的package包/类
public void setConfigurationSchema(File ConfigurationSchemaFile) throws IOException {
this.ConfigurationSchema = JsonLoader.fromFile(ConfigurationSchemaFile);
}