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

java.com.ionic.sdk.agent.request.getresources.GetResourcesResponse Maven / Gradle / Ivy

Go to download

The Ionic Java SDK provides an easy-to-use interface to the Ionic Platform.

There is a newer version: 2.9.0
Show newest version
package com.ionic.sdk.agent.request.getresources;

import com.ionic.sdk.agent.request.base.AgentResponseBase;

import java.util.ArrayList;
import java.util.List;

/**
 * Represents the output for an Agent.getResources() request.
 */
public class GetResourcesResponse extends AgentResponseBase {

    /**
     * Represents a list of Key objects for an Agent.getKeys() response.
     */
    private final List resources;

    /**
     * Constructor.
     */
    public GetResourcesResponse() {
        super();
        this.resources = new ArrayList();
    }

    /**
     * @return a list of Resource objects for an Agent.getResources() response.
     */
    public final List getResources() {
        return resources;
    }

    /**
     * Add a resource response object to the {@link GetResourcesResponse}.
     *
     * @param resource the object containing the parameters of the resource response
     */
    public final void add(final Resource resource) {
        resources.add(resource);
    }

    /**
     * Represents a discrete resource object.
     */
    public static class Resource {

        /**
         * A reference to be used to associate resources received in the response with the request.
         */
        private final String refId;

        /**
         * The content of the requested resource.
         */
        private final String data;

        /**
         * The error, if any, encountered during the server processing of the resource request.
         */
        private final String error;

        /**
         * Constructor.
         *
         * @param refId the reference, supplied by the user in the request, used to associate the request and response
         * @param data  the content of the requested resource
         * @param error the error, if any, encountered during the server processing of the resource request
         */
        public Resource(final String refId, final String data, final String error) {
            this.refId = refId;
            this.data = data;
            this.error = error;
        }

        /**
         * @return the reference, supplied by the user in the request, used to associate the request and response
         */
        public final String getRefId() {
            return refId;
        }

        /**
         * @return the content of the requested resource
         */
        public final String getData() {
            return data;
        }

        /**
         * @return the error, if any, encountered during the server processing of the resource request
         */
        public final String getError() {
            return error;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy