提交 95948434 编写于 作者: T terrymanu

simplify AbstractExecutorWrapper 5th version

上级 e2f40943
/*
* Copyright 1999-2015 dangdang.com.
* <p>
* 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.
* </p>
*/
package com.dangdang.ddframe.rdb.sharding.executor.wrapper;
import com.dangdang.ddframe.rdb.sharding.routing.SQLExecutionUnit;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* 执行上下文基类.
*
* @author zhangliang
*/
@RequiredArgsConstructor
@Getter
public abstract class AbstractExecutorWrapper {
private final SQLExecutionUnit sqlExecutionUnit;
}
......@@ -36,7 +36,10 @@ import java.util.List;
*
* @author zhangliang
*/
public class PreparedStatementExecutorWrapper extends AbstractExecutorWrapper {
public final class PreparedStatementExecutorWrapper {
@Getter
private final SQLExecutionUnit sqlExecutionUnit;
@Getter
private final PreparedStatement preparedStatement;
......@@ -49,7 +52,7 @@ public class PreparedStatementExecutorWrapper extends AbstractExecutorWrapper {
private int batchIndex;
public PreparedStatementExecutorWrapper(final SQLType sqlType, final PreparedStatement preparedStatement, final SQLExecutionUnit sqlExecutionUnit) {
super(sqlExecutionUnit);
this.sqlExecutionUnit = sqlExecutionUnit;
this.preparedStatement = preparedStatement;
switch (sqlType) {
case SELECT:
......
/*
* Copyright 1999-2015 dangdang.com.
* <p>
* 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.
* </p>
*/
package com.dangdang.ddframe.rdb.sharding.executor.wrapper;
import com.dangdang.ddframe.rdb.sharding.routing.SQLExecutionUnit;
import lombok.Getter;
import java.sql.Statement;
/**
* 静态语句对象的执行上下文.
*
* @author zhangliang
*/
public final class StatementExecutorWrapper extends AbstractExecutorWrapper {
@Getter
private final Statement statement;
public StatementExecutorWrapper(final Statement statement, final SQLExecutionUnit sqlExecutionUnit) {
super(sqlExecutionUnit);
this.statement = statement;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册