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

com.evento.common.modeling.messaging.query.Multiple Maven / Gradle / Ivy

The newest version!
package com.evento.common.modeling.messaging.query;

import com.evento.common.modeling.messaging.payload.View;

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

/**
 * Represents a response object that contains multiple instances of a specified type.
 * Extends the `QueryResponse` class.
 *
 * @param  The type of view the Multiple object contains.
 */
public class Multiple extends QueryResponse {

	private Collection data;

	/**
	 * Represents a response object that contains multiple instances of a specified type.
	 * Extends the `QueryResponse` class.
	 *
     */
	public Multiple() {
	}

	/**
	 * Constructs a new Multiple object containing multiple instances of a specified type.
	 *
	 * @param  The type of view the Multiple object contains.
	 * @param data The collection of views to be contained in the Multiple object.
	 * @return A new Multiple object containing the specified views.
	 */
	public static  Multiple of(Collection data) {
		var r = new Multiple();
		r.setData(new ArrayList<>(data));
		return r;
	}

	/**
	 * Constructs a new Multiple object containing multiple instances of a specified type.
	 *
	 * @param  The type of view the Multiple object contains.
	 * @param items The array of views to be contained in the Multiple object.
	 * @return A new Multiple object containing the specified views.
	 */
	@SafeVarargs
	public static  Multiple of(R... items) {
		var r = new Multiple();
		r.setData(List.of(items));
		return r;
	}

	/**
	 * Retrieves the data contained in the Multiple object.
	 *
	 * @return The collection of views contained in the Multiple object.
	 */
	public Collection getData() {
		return data;
	}

	/**
	 * Sets the data for the Multiple object.
	 *
	 * @param data The collection of views to be set as the data for the Multiple object.
	 */
	public void setData(Collection data) {
		this.data = data;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy