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

io.keen.client.java.result.Group Maven / Gradle / Ivy

package io.keen.client.java.result;

import java.util.Collections;
import java.util.Map;
import java.util.Set;

/**
 * Group is an object that contains the Group By properties and the value of the properties.
 *
 * @author claireyoung
 * @since 1.0.0, 07/06/15
 */
public class Group {
    private final Map properties;

    /**
     * @param properties The map of properties to property values.
     */
    public Group(Map properties) {
        this.properties = Collections.unmodifiableMap(properties);
    }

    /**
     * @return properties The map of properties to property values.
     */
    public Map getProperties() {
        return properties;
    }

    /**
     * @return property names.
     */
    public Set getPropertyNames() {
        return properties.keySet();
    }

    /**
     * @param propertyName property name.
     * @return the property value.
     */
    public Object getGroupValue(String propertyName) {
        if (!properties.containsKey(propertyName)) {
            throw new IllegalStateException(
                    "GroupBy does not contain expected property '" + propertyName + "'.");
        }

        return properties.get(propertyName);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy