All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.openapiprocessor.jsonschema.validator.Annotation Maven / Gradle / Ivy

There is a newer version: 2024.4
Show newest version
/*
 * 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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy