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

com.github.twitch4j.helix.domain.ValueWrapper Maven / Gradle / Ivy

The newest version!
package com.github.twitch4j.helix.domain;

import lombok.AccessLevel;
import lombok.Data;
import lombok.Setter;

import java.util.List;

/**
 * A generic container for helix responses that contain a single value.
 *
 * @param  the type of value contained in the wrapper
 */
@Data
@Setter(AccessLevel.PRIVATE)
public class ValueWrapper {

    /**
     * The data returned from the endpoint.
     */
    private List data;

    /**
     * @return the single value contained in the response, or null.
     */
    public T get() {
        return data != null && !data.isEmpty() ? data.get(0) : null;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy