GeneratedKey.java 1.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/*
 * 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>
 */

18
package io.shardingjdbc.core.routing.sharding;
19

20
import io.shardingjdbc.core.parsing.parser.context.condition.Column;
21
import io.shardingjdbc.core.parsing.parser.context.condition.GeneratedKeyCondition;
22 23
import lombok.Getter;
import lombok.RequiredArgsConstructor;
24 25 26

import java.util.LinkedList;
import java.util.List;
27 28 29

/**
 * Generated key.
30
 *
31
 * @author zhangliang
32
 * @author maxiaoguang
33 34 35 36 37
 */
@RequiredArgsConstructor
@Getter
public final class GeneratedKey {
    
38
    private final Column column;
39 40 41 42
    
    private final int index;
    
    private final Number value;
43 44 45 46 47 48 49 50
    
    private final List<Number> generatedKeys = new LinkedList<>();
    
    public GeneratedKey(final GeneratedKeyCondition generatedKeyCondition) {
        column = generatedKeyCondition.getColumn();
        index = generatedKeyCondition.getIndex();
        value = generatedKeyCondition.getValue();
    }
51
}