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

io.openapiprocessor.jsonschema.converter.StringNotNullConverter Maven / Gradle / Ivy

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

package io.openapiprocessor.jsonschema.converter;

import io.openapiprocessor.jsonschema.support.Types;
import org.checkerframework.checker.nullness.qual.Nullable;

/**
 * converts the property {@code value} to {@link String} and throws {@link NoValueException} if the
 * value is {@code null}.
 */
public class StringNotNullConverter implements PropertyConverter {

    @Override
    public String convert (String name, @Nullable Object value, String location) {
        final String result = Types.convertOrNull (location, value, String.class);
        if (result == null)
            throw new NoValueException (location);

        return result;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy