/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.
 */

package org.apache.shardingsphere.core.rewrite.token.pojo;

import lombok.Getter;
import lombok.ToString;
import org.apache.shardingsphere.core.parse.constant.QuoteCharacter;
import org.apache.shardingsphere.core.parse.util.SQLUtil;

/**
 * Table token.
 *
 * @author zhangliang
 * @author panjuan
 */
@Getter
@ToString
public final class TableToken extends SQLToken implements Substitutable {
    
    private final String tableName;
    
    private final int stopIndex;
    
    private final QuoteCharacter quoteCharacter;
    
    public TableToken(final int startIndex, final int stopIndex, final String tableName, final QuoteCharacter quoteCharacter) {
        super(startIndex);
        this.tableName = SQLUtil.getExactlyValue(tableName);
        this.quoteCharacter = quoteCharacter;
        this.stopIndex = stopIndex;
    }
}

@@ -867,19 +867,35 @@
 ort 
-lombok.Gett
+com.google.common.base.Join
 er;%0A
@@ -908,24 +908,22 @@
  lombok.
-ToString
+Getter
 ;%0Aimport
@@ -1042,16 +1042,170 @@
 SQLUtil;
+%0Aimport org.apache.shardingsphere.core.rewrite.placeholder.Alterable;%0Aimport org.apache.shardingsphere.core.route.type.RoutingUnit;%0A%0Aimport java.util.Map;
 %0A%0A/**%0A *
@@ -1278,18 +1278,8 @@
 ter%0A
-@ToString%0A
 publ
@@ -1345,16 +1345,27 @@
 itutable
+, Alterable
  %7B%0A    %0A
@@ -1801,10 +1801,444 @@
 ;%0A    %7D%0A
+    %0A    @Override%0A    public String toString(final RoutingUnit routingUnit, final Map%3CString, String%3E logicAndActualTables) %7B%0A        String actualTableName = logicAndActualTables.get(tableName.toLowerCase());%0A        actualTableName = null == actualTableName ? tableName.toLowerCase() : actualTableName;%0A        return Joiner.on(%22%22).join(quoteCharacter.getStartDelimiter(), actualTableName, quoteCharacter.getEndDelimiter());%0A    %7D%0A
 %7D%0A

modify ToString