io.openapiprocessor.jsonschema.validator.Annotation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of json-schema-validator Show documentation
Show all versions of json-schema-validator Show documentation
OpenAPI Parser JSON-Schema Validator
/*
* Copyright 2022 https://github.com/openapi-processor/openapi-parser
* PDX-License-Identifier: Apache-2.0
*/
package io.openapiprocessor.jsonschema.validator;
import java.util.Collection;
public class Annotation {
private final String keyword;
private final Object value;
public Annotation (String keyword, Object value) {
this.keyword = keyword;
this.value = value;
}
public String getKeyword () {
return keyword;
}
public Object getValue () {
return value;
}
public boolean is (Class type) {
return type.isInstance (value);
}
public Boolean asBoolean () {
return (Boolean) value;
}
public Integer asInteger () {
return (Integer) value;
}
@SuppressWarnings ("unchecked")
public Collection asStrings () {
return (Collection) value;
}
@SuppressWarnings ("unchecked")
public Collection asIntegers () {
return (Collection) value;
}
}