src/jdk.incubator.adba/share/classes/jdk/incubator/sql2/RowCountOperation.java
author lancea
Wed, 20 Jun 2018 15:38:40 -0400
branchJDK-8188051-branch
changeset 56797 fb523d4d9185
child 56832 4f7713e6a308
permissions -rw-r--r--
JDK-8188051-branch updates
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
56797
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
     1
/*
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
     2
 * Copyright (c)  2017, 2018, Oracle and/or its affiliates. All rights reserved.
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
     4
 *
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    10
 *
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    15
 * accompanied this code).
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    16
 *
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    20
 *
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    23
 * questions.
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    24
 */
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    25
package jdk.incubator.sql2;
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    26
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    27
import java.time.Duration;
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    28
import java.util.function.Consumer;
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    29
import java.util.function.Function;
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    30
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    31
/**
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    32
 * An {@link Operation} that returns a count.
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    33
 *
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    34
 * @param <T> the type of the result of the {@link Operation}
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    35
 * @see ParameterizedCountOperation
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    36
 */
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    37
public interface RowCountOperation<T> extends Operation<T> {
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    38
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    39
  /**
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    40
   * Sets the result processor for this {@link Operation}.
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    41
   * 
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    42
   * @param function processes the count produced by executing this
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    43
   * {@link Operation} and returns the result
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    44
   * @return this {@link RowCountOperation}
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    45
   * @throws IllegalStateException if this method has been called previously
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    46
   */
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    47
  public RowCountOperation<T> apply(Function<Result.RowCount, ? extends T> function);
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    48
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    49
  @Override
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    50
  public RowCountOperation<T> onError(Consumer<Throwable> handler);
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    51
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    52
  @Override
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    53
  public RowCountOperation<T> timeout(Duration minTime);
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    54
  
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    55
}