/*
 * 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 org.apache.shardingsphere.core.constant.OrderDirection;

import java.util.List;

/**
 * Order by token.
 *
 * @author zhangliang
 * @author panjuan
 */
public final class OrderByToken extends SQLToken implements Attachable {
    
    private final List<String> columnLabels;
    
    private final List<OrderDirection> orderDirections;
    
    public OrderByToken(final int startIndex, final List<String> columnLabels, final List<OrderDirection> orderDirections) {
        super(startIndex);
        this.columnLabels = columnLabels;
        this.orderDirections = orderDirections;
    }
    
    @Override
    public String toString() {
        StringBuilder result = new StringBuilder();
        result.append(" ORDER BY ");
        for (int i = 0; i < columnLabels.size(); i++) {
            if (0 == i) {
                result.append(columnLabels.get(i)).append(" ").append(orderDirections.get(i).name());
            } else {
                result.append(",").append(columnLabels.get(i)).append(" ").append(orderDirections.get(i).name());
            }
        }
        result.append(" ");
        return result.toString();
    }
}

@@ -856,16 +856,38 @@
 .pojo;%0A%0A
+import lombok.Getter;%0A
 import o
@@ -942,16 +942,45 @@
 ction;%0A%0A
+import java.util.LinkedList;%0A
 import j
@@ -1066,16 +1066,24 @@
 uan%0A */%0A
+@Getter%0A
 public f
@@ -1191,24 +1191,45 @@
 columnLabels
+ = new LinkedList%3C%3E()
 ;%0A    %0A    p
@@ -1273,24 +1273,45 @@
 erDirections
+ = new LinkedList%3C%3E()
 ;%0A    %0A    p
@@ -1353,204 +1353,37 @@
 ndex
-, final List%3CString%3E columnLabels, final List%3COrderDirection%3E orderDirections) %7B%0A        super(startIndex);%0A        this.columnLabels = columnLabels;%0A        this.orderDirections = orderDirections
+) %7B%0A        super(startIndex)
 ;%0A  

modify OrderByToken()