Skip to content

Commit 507338d

Browse files
committed
Use a constant for the default parameter prefix
1 parent 37e20dd commit 507338d

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/main/java/org/mybatis/dynamic/sql/render/RenderingStrategy.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
public abstract class RenderingStrategy {
2323
public static final RenderingStrategy MYBATIS3 = new MyBatis3RenderingStrategy();
2424
public static final RenderingStrategy SPRING_NAMED_PARAMETER = new SpringNamedParameterRenderingStrategy();
25+
public static final String DEFAULT_PARAMETER_PREFIX = "parameters"; //$NON-NLS-1$
2526

2627
public String getFormattedJdbcPlaceholder(BindableColumn<?> column, String prefix, String parameterName) {
2728
return getFormattedJdbcPlaceholder(Optional.of(column), prefix, parameterName);

src/main/java/org/mybatis/dynamic/sql/select/render/SelectRenderer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ private String orderByPhrase(SortSpecification column) {
7979
}
8080

8181
private String renderLimit(Map<String, Object> parameters, Long limit) {
82-
String placeholder = renderingStrategy.getFormattedJdbcPlaceholder("parameters", LIMIT_PARAMETER); //$NON-NLS-1$
82+
String placeholder = renderingStrategy.getFormattedJdbcPlaceholder(RenderingStrategy.DEFAULT_PARAMETER_PREFIX, LIMIT_PARAMETER);
8383
parameters.put(LIMIT_PARAMETER, limit);
8484
return "limit " + placeholder; //$NON-NLS-1$
8585
}
8686

8787
private String renderOffset(Map<String, Object> parameters, Long offset) {
88-
String placeholder = renderingStrategy.getFormattedJdbcPlaceholder("parameters", OFFSET_PARAMETER); //$NON-NLS-1$
88+
String placeholder = renderingStrategy.getFormattedJdbcPlaceholder(RenderingStrategy.DEFAULT_PARAMETER_PREFIX, OFFSET_PARAMETER);
8989
parameters.put(OFFSET_PARAMETER, offset);
9090
return "offset " + placeholder; //$NON-NLS-1$
9191
}

src/main/java/org/mybatis/dynamic/sql/update/render/SetPhraseVisitor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2016-2018 the original author or authors.
2+
* Copyright 2016-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -111,6 +111,6 @@ public FragmentAndParameters visit(ColumnMapping mapping) {
111111

112112
private Function<SqlColumn<?>, String> toJdbcPlaceholder(String parameterName) {
113113
return column -> renderingStrategy
114-
.getFormattedJdbcPlaceholder(column, "parameters", parameterName); //$NON-NLS-1$
114+
.getFormattedJdbcPlaceholder(column, RenderingStrategy.DEFAULT_PARAMETER_PREFIX, parameterName);
115115
}
116116
}

src/main/java/org/mybatis/dynamic/sql/where/render/WhereConditionVisitor.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2016-2018 the original author or authors.
2+
* Copyright 2016-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -142,12 +142,11 @@ public static <T> Builder<T> withColumn(BindableColumn<T> column) {
142142
}
143143

144144
public static class Builder<T> {
145-
private static final String DEFAULT_PARAMETER_PREFIX = "parameters"; //$NON-NLS-1$
146145
private RenderingStrategy renderingStrategy;
147146
private AtomicInteger sequence;
148147
private BindableColumn<T> column;
149148
private TableAliasCalculator tableAliasCalculator;
150-
private String parameterPrefix = DEFAULT_PARAMETER_PREFIX;
149+
private String parameterPrefix = RenderingStrategy.DEFAULT_PARAMETER_PREFIX;
151150

152151
public Builder<T> withSequence(AtomicInteger sequence) {
153152
this.sequence = sequence;
@@ -171,7 +170,7 @@ public Builder<T> withTableAliasCalculator(TableAliasCalculator tableAliasCalcul
171170

172171
public Builder<T> withParameterName(String parameterName) {
173172
if (parameterName != null) {
174-
parameterPrefix = parameterName + "." + DEFAULT_PARAMETER_PREFIX; //$NON-NLS-1$
173+
parameterPrefix = parameterName + "." + RenderingStrategy.DEFAULT_PARAMETER_PREFIX; //$NON-NLS-1$
175174
}
176175
return this;
177176
}

0 commit comments

Comments
 (0)