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

com.marklogic.client.dataservices.impl.InputCallerImpl Maven / Gradle / Ivy

The newest version!
/*
 * Copyright © 2024 MarkLogic Corporation. All Rights Reserved.
 */
package com.marklogic.client.dataservices.impl;

import com.marklogic.client.DatabaseClient;
import com.marklogic.client.io.marker.BufferableContentHandle;
import com.marklogic.client.io.marker.JSONWriteHandle;

final public class InputCallerImpl extends IOCallerImpl {
    public InputCallerImpl(JSONWriteHandle apiDeclaration, HandleProvider handleProvider) {
        super(apiDeclaration, handleProvider);

        if (getInputParamdef() == null) {
            throw new IllegalArgumentException("input parameter missing in endpoint: "+ getEndpointPath());
        }

        ReturndefImpl returndef = getReturndef();
        if (returndef != null) {
            if (getEndpointStateParamdef() == null) {
                throw new IllegalArgumentException(
                        "cannot have return without endpointState parameter in endpoint: "+ getEndpointPath()
                );
            } else if (returndef.isMultiple()) {
                throw new IllegalArgumentException("return cannot be multiple in endpoint: "+ getEndpointPath());
            }
        }
    }

    public void arrayCall(DatabaseClient db, CallContextImpl callCtxt, BufferableContentHandle[] input) {
        responseWithState(makeRequest(db, callCtxt, input), callCtxt);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy