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

io.openapiprocessor.jsonschema.schema.Vocabulary Maven / Gradle / Ivy

There is a newer version: 2024.4
Show newest version
/*
 * Copyright 2023 https://github.com/openapi-processor/openapi-parser
 * PDX-License-Identifier: Apache-2.0
 */

package io.openapiprocessor.jsonschema.schema;

import org.checkerframework.checker.nullness.qual.Nullable;

import java.util.Map;

// todo interface VocabularySingle, VocabularyComposite ???
public class Vocabulary {
    private final String uri;
    private final Map keywords;

    public Vocabulary(Map keywords) {
        this.uri = "";
        this.keywords = keywords;
    }

    public Vocabulary(String uri, Map keywords) {
        this.uri = uri;
        this.keywords = keywords;
    }

    public String getUri() {
        return uri;
    }

    public boolean isKeyword (String candidate) {
        return keywords.containsKey (candidate);
    }

    public @Nullable Keyword getKeyword (String keyword) {
        return keywords.get (keyword);
    }

    public boolean isNavigable (String keyword) {
        Keyword match = keywords.get (keyword);
        if (match == null)
            return false;

        return match.isNavigable ();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy