${database.allClassCopyright}package ${myBaseDaoCursorPackageName};
#set ($myClassName = "${myBaseTypeSafeCursorHandlerClassName}")
import java.sql.ResultSet;
import java.sql.SQLException;

import org.seasar.dbflute.jdbc.CursorHandler;
import ${myExtendedDaoCursorPackageName}.${myExtendedTypeSafeCursorClassName};

/**
 * The cursor handler of ${table.name}.
 * @author ${database.classAuthor}
 */
public abstract class ${myClassName} implements CursorHandler {

    /**
     * Handle the result set.
     * @param rs Result set. (NotNull)
     * @return Result. (Nullable)
     * @throws SQLException
     */
    public Object handle(ResultSet rs) throws SQLException {
        return fetchCursor(createTypeSafeCursor(rs));
    }

    /**
     * Create type safe cursor.
     * @param rs Result set. (NotNull)
     * @return Type safe cursor. (Nullable)
     * @throws SQLException
     */
    protected ${myExtendedTypeSafeCursorClassName} createTypeSafeCursor(ResultSet rs) throws SQLException {
        final ${myExtendedTypeSafeCursorClassName} cursor = new ${myExtendedTypeSafeCursorClassName}();
        cursor.accept(rs);
        return cursor;
    }

    /**
     * Fetch the cursor.
     * @param cursor Type safe cursor. (NotNull)
     * @return Result. (Nullable)
     * @throws java.sql.SQLException
     */
    protected abstract Object fetchCursor(${myExtendedTypeSafeCursorClassName} cursor) throws SQLException;
}
