package com.ctrip.platform.dal.dao.configure;


import com.ctrip.framework.dal.cluster.client.config.DalConfigCustomizedOption;
import com.ctrip.framework.dal.cluster.client.database.DatabaseRole;

public class DefaultDalConfigCustomizedOption implements DalConfigCustomizedOption {

    private String consistencyTypeCustomizedClass; // user customized drc-consistency-strategy class
    private boolean ignoreShardingResourceNotFound = false; // allow user not define sharding-customized-strategy class
    private boolean forceInitialize = false;
    private Integer shardIndex;
    private DatabaseRole databaseRole = DatabaseRole.MASTER;
    private String readStrategy;
    private String tag;

    @Override
    public String getConsistencyTypeCustomizedClass() {
        return consistencyTypeCustomizedClass;
    }

    @Override
    public boolean isIgnoreShardingResourceNotFound() {
        return ignoreShardingResourceNotFound;
    }

    @Override
    public boolean isForceInitialize() {
        return forceInitialize;
    }

    @Override
    public Integer getShardIndex() {
        return shardIndex;
    }

    @Override
    public DatabaseRole getDatabaseRole() {
        return databaseRole;
    }

    @Override
    public String getRouteStrategy() {
        return readStrategy;
    }

    @Override
    public String getTag() {
        return tag;
    }

    public DefaultDalConfigCustomizedOption consistencyTypeCustomizedClass(String clazz) {
        this.consistencyTypeCustomizedClass = clazz;
        return this;
    }

    public DefaultDalConfigCustomizedOption ignoreShardingResourceNotFound(boolean allowDefault) {
        this.ignoreShardingResourceNotFound = allowDefault;
        return this;
    }

    public DefaultDalConfigCustomizedOption forceInitialize(boolean forceInitialize) {
        this.forceInitialize = forceInitialize;
        return this;
    }

    public DefaultDalConfigCustomizedOption shardIndex(Integer shardIndex) {
        this.shardIndex = shardIndex;
        return this;
    }

    public DefaultDalConfigCustomizedOption databaseRole(DatabaseRole databaseRole) {
        this.databaseRole = databaseRole;
        return this;
    }

    public DefaultDalConfigCustomizedOption readStrategy(String readStrategy) {
        this.readStrategy = readStrategy;
        return this;
    }

    public DefaultDalConfigCustomizedOption tag(String tag) {
        this.tag = tag;
        return this;
    }

    @Override
    public DefaultDalConfigCustomizedOption clone() {
        return new DefaultDalConfigCustomizedOption()
                .databaseRole(this.databaseRole)
                .shardIndex(this.shardIndex)
                .forceInitialize(this.forceInitialize)
                .ignoreShardingResourceNotFound(this.ignoreShardingResourceNotFound)
                .consistencyTypeCustomizedClass(this.consistencyTypeCustomizedClass)
                .readStrategy(this.readStrategy)
                .tag(this.tag);
    }
}

@@ -2612,25 +2612,28 @@
 seRole(this.
-d
+getD
 atabaseRole)
@@ -2631,16 +2631,18 @@
 baseRole
+()
 )%0A      
@@ -2664,25 +2664,28 @@
 dIndex(this.
-s
+getS
 hardIndex)%0A 
@@ -2681,16 +2681,18 @@
 ardIndex
+()
 )%0A      
@@ -2719,25 +2719,27 @@
 ialize(this.
-f
+isF
 orceInitiali
@@ -2740,16 +2740,18 @@
 itialize
+()
 )%0A      
@@ -2794,24 +2794,26 @@
 Found(this.i
+sI
 gnoreShardin
@@ -2829,16 +2829,18 @@
 NotFound
+()
 )%0A      
@@ -2882,25 +2882,28 @@
 dClass(this.
-c
+getC
 onsistencyTy
@@ -2919,16 +2919,18 @@
 zedClass
+()
 )%0A      
@@ -2958,28 +2958,32 @@
 gy(this.
-read
+getRoute
 Strategy
 )%0A      
@@ -2974,16 +2974,18 @@
 Strategy
+()
 )%0A      
@@ -3004,19 +3004,24 @@
 ag(this.
-tag
+getTag()
 );%0A    %7D

use method to clone a instance