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

com.mysema.query.group.Group Maven / Gradle / Ivy

There is a newer version: 3.7.4
Show newest version
/*
 * Copyright 2015, The Querydsl Team (http://www.querydsl.com/team)
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.mysema.query.group;

import java.util.*;

import com.mysema.query.types.Expression;

/**
 * A group of rows. Group is build according to GroupDefinitions. 
 *
 * @author sasa
 *
 */
public interface Group {

    /**
     * @return Groups elements as an array
     */
    Object[] toArray();

    /**
     * Returns the value of the given group. 
     *
     * @param  Type of element in a single ResultSet row, i.e. type of {@code Expression}
     * @param  Target type of this group, e.g. {@code List}
     * @param coldef
     * @throws NoSuchElementException if group is undefined.
     * @throws ClassCastException if group is of different type  
     * @return Value of given group definition in this group
     */
     R getGroup(GroupExpression coldef);

    /**
     * Returns the value of the given single valued expression. This is the 
     * first value of given column within this group of the ResultSet. 
     *
     * @param  Value type
     * @param expr Grouped expression
     * @throws NoSuchElementException if group is undefined.  
     * @throws ClassCastException if group is of different type (e.g. Set)
     * @return Value of given expression in this group
     */
     T getOne(Expression expr);

    /**
     * Returns a Set of values in this group. 
     *
     * @param  Value type of Set
     * @param expr Grouped expression
     * @throws NoSuchElementException if group is undefined.  
     * @throws ClassCastException if group is of different type (e.g. List)
     * @return Set of values in this group
     */
     Set getSet(Expression expr);

    /**
     * Returns a SortedSet of values in this group.
     *
     * @param  Value type of Set
     * @param expr Grouped expression
     * @throws NoSuchElementException if group is undefined.
     * @throws ClassCastException if group is of different type (e.g. List)
     * @return Set of values in this group
     */
     SortedSet getSortedSet(Expression expr);

    /**
     * Returns a List of values in this group.
     *
     * @param  Value type of List
     * @param expr Grouped expression
     * @throws NoSuchElementException if group is undefined.
     * @throws ClassCastException if group is of different type (e.g. Set)
     * @return List of values in this group
     */
     List getList(Expression expr);

    /**
     * Returns a Map of values in this group
     *
     * @param  Key type of result Map
     * @param  Value type of result Map
     * @param key Key expression
     * @param value Value expression
     * @throws NoSuchElementException if group is undefined.
     * @throws ClassCastException if group is of different type (e.g. List)
     * @return Map of values in this group
     */
     Map getMap(Expression key, Expression value);

    /**
     * Returns a SortedMap of values in this group
     *
     * @param  Key type of result Map
     * @param  Value type of result Map
     * @param key Key expression
     * @param value Value expression
     * @throws NoSuchElementException if group is undefined.
     * @throws ClassCastException if group is of different type (e.g. List)
     * @return Map of values in this group
     */
     SortedMap getSortedMap(Expression key, Expression value);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy