當前位置: 首頁>>代碼示例>>Java>>正文


Java ProcessingReport.toString方法代碼示例

本文整理匯總了Java中com.github.fge.jsonschema.core.report.ProcessingReport.toString方法的典型用法代碼示例。如果您正苦於以下問題:Java ProcessingReport.toString方法的具體用法?Java ProcessingReport.toString怎麽用?Java ProcessingReport.toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.github.fge.jsonschema.core.report.ProcessingReport的用法示例。


在下文中一共展示了ProcessingReport.toString方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: validateSchema

import com.github.fge.jsonschema.core.report.ProcessingReport; //導入方法依賴的package包/類
private JsonSchema validateSchema(JsonNode jsonSchema)
        throws UnRAVLException {

    try {
        final JsonSchemaFactory factory = JsonSchemaFactory.byDefault();
        final JsonSchema schema = factory.getJsonSchema(jsonSchema);
        SyntaxValidator syntaxValidator = factory.getSyntaxValidator();
        if (!syntaxValidator.schemaIsValid(jsonSchema)) {
            throw new UnRAVLException("JSON schema is invalid");
        }
        ProcessingReport report = syntaxValidator
                .validateSchema(jsonSchema);
        boolean success = report.isSuccess();
        if (!success) {
            throw new UnRAVLAssertionException(report.toString());
        }
        return schema;
    } catch (ProcessingException e) {
        throw new UnRAVLException(e);
    }
}
 
開發者ID:sassoftware,項目名稱:unravl,代碼行數:22,代碼來源:SchemaAssertion.java

示例2: valdate

import com.github.fge.jsonschema.core.report.ProcessingReport; //導入方法依賴的package包/類
@Override
public boolean valdate(final IActivityLogger aLogger,
		final CJsonSchema aSchema, final JSONObject aData) throws Exception {
	// validate json
	try {
		aLogger.logDebug(this, "getSchema",
				"create JsonNode fro JSONObject for the data");
		ObjectMapper wMapper = new ObjectMapper();
		JsonNode wJson = wMapper.readTree(aData.toString());

		aLogger.logDebug(this, "getSchema", "validate data with schema");
		ProcessingReport wReport = aSchema.getSchema()
				.validate(wJson, true);
		if (wReport.isSuccess()) {
			return true;
		} else {
			throw new SchemaException("ERROR; failed schema validation ! ["
					+ wReport.toString() + "] ");
		}
	} catch (Exception e) {
		throw new SchemaException(e, e.getMessage());
	}
}
 
開發者ID:isandlaTech,項目名稱:cohorte-utilities,代碼行數:24,代碼來源:CJsonValidatorDefault.java

示例3: getValidationResult

import com.github.fge.jsonschema.core.report.ProcessingReport; //導入方法依賴的package包/類
private final ValidationResult getValidationResult(JsonNode jsonNode) throws IOException {
    try {
           ProcessingReport processingReport = schema.validate(jsonNode);
           if (processingReport != null) {
               return new ValidationResult(processingReport.isSuccess(), processingReport.toString());
           } else {
               return new ValidationResult(false, null);
           }
       } catch (ProcessingException e) {
           throw new IOException(e.getMessage());
       }
}
 
開發者ID:ad-tech-group,項目名稱:openssp,代碼行數:13,代碼來源:GenericOpenRtbValidator.java

示例4: validate

import com.github.fge.jsonschema.core.report.ProcessingReport; //導入方法依賴的package包/類
@Override
public void validate(Object value) throws ValidationFailedException {
    JsonNode valueNode = _objectMapper.valueToTree(value);
    try {
        ProcessingReport report = _schema.validate(valueNode);
        if (!report.isSuccess()) {
            throw new ValidationFailedException("Validation of data failed: " + report.toString());
        }
    } catch (ProcessingException e) {
        throw new ValidationFailedException("Validation of data failed: " + e.getMessage());
    }
}
 
開發者ID:SimpleQueryProtocol,項目名稱:sqp,代碼行數:13,代碼來源:SchemaTypeValidator.java

示例5: validate

import com.github.fge.jsonschema.core.report.ProcessingReport; //導入方法依賴的package包/類
private void validate(String schemaPath, String filePath) throws IOException, ProcessingException {
    JsonNode schema = JsonLoader.fromResource(schemaPath);
    JsonNode json = JsonLoader.fromPath(filePath);
    com.github.fge.jsonschema.main.JsonValidator validator = JsonSchemaFactory.byDefault().getValidator();
    ProcessingReport report = validator.validate(schema, json);

    if ((report == null) || !report.isSuccess()) {
        logger.error("Invalid JSON");
        if (report != null) {
            throw new ProcessingException(report.toString());
        } else {
            throw new ProcessingException("JSON validation report is null for " + filePath);
        }
    }
}
 
開發者ID:flipkart-incubator,項目名稱:Poseidon,代碼行數:16,代碼來源:JsonValidator.java

示例6: validateValueAgainstSchema

import com.github.fge.jsonschema.core.report.ProcessingReport; //導入方法依賴的package包/類
private void validateValueAgainstSchema(JsonNode node, JsonSchema schema)
        throws UnRAVLException {
    try {
        ProcessingReport report = schema.validate(node, true);
        boolean success = report.isSuccess();
        if (!success) {
            throw new UnRAVLAssertionException(report.toString());
        }
    } catch (ProcessingException e) {
        throw new UnRAVLException(e);
    }
}
 
開發者ID:sassoftware,項目名稱:unravl,代碼行數:13,代碼來源:SchemaAssertion.java


注:本文中的com.github.fge.jsonschema.core.report.ProcessingReport.toString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。