1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.shardingsphere.sql.parser.sql.common.segment.dml.pagination.rownum;
19
20 import lombok.EqualsAndHashCode;
21 import lombok.Getter;
22 import lombok.Setter;
23 import org.apache.shardingsphere.sql.parser.sql.common.segment.dml.pagination.ParameterMarkerPaginationValueSegment;
24 import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.bounded.ColumnSegmentBoundedInfo;
25 import org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
26
27 import java.util.Optional;
28
29
30
31
32 @Getter
33 @EqualsAndHashCode(exclude = "boundedInfo", callSuper = true)
34 public final class ParameterMarkerRowNumberValueSegment extends RowNumberValueSegment implements ParameterMarkerPaginationValueSegment {
35
36 private final int parameterIndex;
37
38 @Setter
39 private ColumnSegmentBoundedInfo boundedInfo;
40
41 public ParameterMarkerRowNumberValueSegment(final int startIndex, final int stopIndex, final int paramIndex, final boolean boundOpened) {
42 super(startIndex, stopIndex, boundOpened);
43 parameterIndex = paramIndex;
44 }
45
46 @Override
47 public ColumnSegmentBoundedInfo getBoundedInfo() {
48 return Optional.ofNullable(boundedInfo).orElseGet(() -> new ColumnSegmentBoundedInfo(new IdentifierValue("")));
49 }
50 }