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

net.ttddyy.dsproxy.proxy.StatementMethodNames Maven / Gradle / Ivy

There is a newer version: 1.10
Show newest version
package net.ttddyy.dsproxy.proxy;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

/**
 * Method names that proxy logic classes have interested in.
 *
 * @author Tadaya Tsuyukubo
 * @see java.sql.Statement
 * @see java.sql.PreparedStatement
 * @see java.sql.CallableStatement
 * @since 1.2
 */
public interface StatementMethodNames {

    static final String PARAMETER_METHOD_SET_NULL = "setNull";
    static final String PARAMETER_METHOD_REGISTER_OUT_PARAMETER = "registerOutParameter";

    static final Set PARAMETER_METHODS = Collections.unmodifiableSet(
            new HashSet(Arrays.asList("setArray", "setAsciiStream", "setBigDecimal",
                    "setBinaryStream", "setBlob", "setBoolean", "setByte",
                    "setBytes", "setCharacterStream", "setClob", "setDate",
                    "setDouble", "setFloat", "setInt", "setLong",
                    PARAMETER_METHOD_SET_NULL,
                    "setObject", "setRef", "setShort",
                    "setString", "setTime", "setTimestamp", "setUnicodeStream", "setURL",
                    "setRowId", "setNString", "setNCharacterStream", "setNClob", "setSQLXML",
                    "clearParameters",
                    PARAMETER_METHOD_REGISTER_OUT_PARAMETER  // CallableStatement output parameter
            ))
    );

    static final Set BATCH_PARAM_METHODS = Collections.unmodifiableSet(
            new HashSet(Arrays.asList("addBatch", "clearBatch"))
    );

    static final Set BATCH_EXEC_METHODS = Collections.unmodifiableSet(
            new HashSet(Arrays.asList(
                    "executeBatch",
                    "executeLargeBatch"  // JDBC 4.2 (Java1.8)
            ))
    );
    static final Set QUERY_EXEC_METHODS = Collections.unmodifiableSet(
            new HashSet(Arrays.asList(
                    "executeQuery", "executeUpdate", "execute",
                    "executeLargeUpdate"  // JDBC 4.2 (Java1.8)
            ))
    );
    static final Set EXEC_METHODS = Collections.unmodifiableSet(
            new HashSet() {
                {
                    addAll(BATCH_EXEC_METHODS);
                    addAll(QUERY_EXEC_METHODS);
                }
            }
    );

    static final Set JDBC4_METHODS = Collections.unmodifiableSet(
            new HashSet(Arrays.asList("unwrap", "isWrapperFor"))
    );

    static final Set GET_CONNECTION_METHOD = Collections.unmodifiableSet(
            new HashSet(Arrays.asList("getConnection"))
    );

    static final Set METHODS_TO_INTERCEPT = Collections.unmodifiableSet(
            new HashSet() {
                {
                    addAll(PARAMETER_METHODS);
                    addAll(BATCH_PARAM_METHODS);
                    addAll(EXEC_METHODS);
                    addAll(JDBC4_METHODS);
                    addAll(GET_CONNECTION_METHOD);
                    add("getDataSourceName");
                    add("toString");
                    add("getTarget"); // from ProxyJdbcObject
                }
            }
    );

    static final Set METHODS_TO_OPERATE_PARAMETER = Collections.unmodifiableSet(
            new HashSet() {
                {
                    addAll(PARAMETER_METHODS);
                    addAll(BATCH_PARAM_METHODS);
                }
            }
    );


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy