Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
  * The ASF licenses this file to You 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 org.apache.commons.dbutils.handlers;
ResultSetHandler implementation that converts a ResultSet into a List of beans. This class is thread safe.

Parameters:
<T> the target bean type
See also:
org.apache.commons.dbutils.ResultSetHandler
public class BeanListHandler<T> implements ResultSetHandler<List<T>> {

    
The Class of beans produced by this handler.
    private final Class<T> type;

    
The RowProcessor implementation to use when converting rows into beans.
    private final RowProcessor convert;

    
Creates a new instance of BeanListHandler.

Parameters:
type The Class that objects returned from handle() are created from.
    public BeanListHandler(Class<T> type) {
        this(type.);
    }

    
Creates a new instance of BeanListHandler.

Parameters:
type The Class that objects returned from handle() are created from.
convert The RowProcessor implementation to use when converting rows into beans.
    public BeanListHandler(Class<T> typeRowProcessor convert) {
        this. = type;
        this. = convert;
    }

    
Convert the whole ResultSet into a List of beans with the Class given in the constructor.

Parameters:
rs The ResultSet to handle.
Returns:
A List of beans, never null.
Throws:
java.sql.SQLException if a database access error occurs
See also:
org.apache.commons.dbutils.RowProcessor.toBeanList(java.sql.ResultSet,java.lang.Class)
    @Override
    public List<T> handle(ResultSet rsthrows SQLException {
        return this..toBeanList(rs);
    }
New to GrepCode? Check out our FAQ X