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

io.muserver.openapi.CallbackObject Maven / Gradle / Ivy

The newest version!
package io.muserver.openapi;

import java.io.IOException;
import java.io.Writer;
import java.util.Map;

import static io.muserver.Mutils.notNull;

/**
 * @see CallbackObjectBuilder
 */
public class CallbackObject implements JsonWriter {

    private final Map callbacks;

    CallbackObject(Map callbacks) {
        notNull("callbacks", callbacks);
        this.callbacks = callbacks;
    }

    @Override
    public void writeJson(Writer writer) throws IOException {
        writer.append('{');

        boolean isFirst = true;
        for (Map.Entry entry : callbacks.entrySet()) {
            isFirst = Jsonizer.append(writer, entry.getKey(), entry.getValue(), isFirst);
        }

        writer.append('}');

    }

    /**
     * @return the value described by {@link CallbackObjectBuilder#withCallbacks}
     */
    public Map callbacks() {
        return callbacks;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy