Skip to content

Commit 8493f98

Browse files
committed
DATAJDBC-309 - Polishing.
Add since tags. Improve Javadoc.
1 parent 48bf6c2 commit 8493f98

File tree

69 files changed

+209
-165
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+209
-165
lines changed

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/AbstractSegment.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* Abstract implementation to support {@link Segment} implementations.
2222
*
2323
* @author Mark Paluch
24+
* @since 1.1
2425
*/
2526
abstract class AbstractSegment implements Segment {
2627

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/Aliased.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* Aliased element exposing an {@link #getAlias() alias}.
2020
*
2121
* @author Mark Paluch
22+
* @since 1.1
2223
*/
2324
public interface Aliased {
2425

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/AliasedExpression.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* An expression with an alias.
2020
*
2121
* @author Jens Schauder
22+
* @since 1.1
2223
*/
2324
class AliasedExpression extends AbstractSegment implements Aliased, Expression {
2425

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/AndCondition.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* {@link Condition} representing an {@code AND} relation between two {@link Condition}s.
2020
*
2121
* @author Mark Paluch
22+
* @since 1.1
2223
* @see Condition#and(Condition)
2324
*/
2425
public class AndCondition extends MultipleCondition {

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/AsteriskFromTable.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@
1919
* {@link Segment} to select all columns from a {@link Table}.
2020
* <p/>
2121
* * Renders to: {@code
22-
* <table>
22+
*
23+
<table>
2324
* .*} as in {@code SELECT
24-
* <table>
25+
*
26+
<table>
2527
* .* FROM …}.
2628
*
2729
* @author Mark Paluch
30+
* @since 1.1
2831
* @see Table#asterisk()
2932
*/
3033
public class AsteriskFromTable extends AbstractSegment implements Expression {

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/BindMarker.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* Bind marker/parameter placeholder used to construct prepared statements with parameter substitution.
2222
*
2323
* @author Mark Paluch
24+
* @since 1.1
2425
*/
2526
public class BindMarker extends AbstractSegment implements Expression {
2627

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/Column.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* Renders to: {@code <name>} or {@code <table(alias)>.<name>}.
2525
*
2626
* @author Mark Paluch
27+
* @since 1.1
2728
*/
2829
public class Column extends AbstractSegment implements Expression, Named {
2930

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/Comparison.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* Results in a rendered condition: {@code <left> <comparator> <right>} (e.g. {@code col = 'predicate'}.
2424
*
2525
* @author Mark Paluch
26+
* @since 1.1
2627
*/
2728
public class Comparison extends AbstractSegment implements Condition {
2829

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/Condition.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
*
2121
* @author Mark Paluch
2222
* @author Jens Schauder
23+
* @since 1.1
2324
* @see Conditions
2425
*/
2526
public interface Condition extends Segment {

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/Conditions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
*
2727
* @author Mark Paluch
2828
* @author Jens Schauder
29+
* @since 1.1
2930
* @see SQL
3031
* @see Expressions
3132
* @see Functions

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/DefaultSelect.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* Default {@link Select} implementation.
2727
*
2828
* @author Mark Paluch
29+
* @since 1.1
2930
*/
3031
class DefaultSelect implements Select {
3132

@@ -39,7 +40,7 @@ class DefaultSelect implements Select {
3940
private final List<OrderByField> orderBy;
4041

4142
DefaultSelect(boolean distinct, List<Expression> selectList, List<Table> from, long limit, long offset,
42-
List<Join> joins, @Nullable Condition where, List<OrderByField> orderBy) {
43+
List<Join> joins, @Nullable Condition where, List<OrderByField> orderBy) {
4344

4445
this.distinct = distinct;
4546
this.selectList = new SelectList(new ArrayList<>(selectList));

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/DefaultSelectBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* Default {@link SelectBuilder} implementation.
3131
*
3232
* @author Mark Paluch
33+
* @since 1.1
3334
*/
3435
class DefaultSelectBuilder implements SelectBuilder, SelectAndFrom, SelectFromAndJoin, SelectWhereAndOr {
3536

@@ -39,7 +40,7 @@ class DefaultSelectBuilder implements SelectBuilder, SelectAndFrom, SelectFromAn
3940
private long limit = -1;
4041
private long offset = -1;
4142
private List<Join> joins = new ArrayList<>();
42-
private Condition where;
43+
private @Nullable Condition where;
4344
private List<OrderByField> orderBy = new ArrayList<>();
4445

4546
/*

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/Expression.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@
1919
* Expression that can be used in select lists.
2020
*
2121
* @author Mark Paluch
22+
* @since 1.1
2223
* @see SQL
2324
* @see Expressions
2425
*/
25-
public interface Expression extends Segment {
26-
27-
}
26+
public interface Expression extends Segment {}

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/Expressions.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* Factory for common {@link Expression}s.
2020
*
2121
* @author Mark Paluch
22+
* @since 1.1
2223
* @see SQL
2324
* @see Conditions
2425
* @see Functions
@@ -52,8 +53,7 @@ public static Expression asterisk(Table table) {
5253
}
5354

5455
// Utility constructor.
55-
private Expressions() {
56-
}
56+
private Expressions() {}
5757

5858
static class SimpleExpression extends AbstractSegment implements Expression {
5959

@@ -69,7 +69,3 @@ public String toString() {
6969
}
7070
}
7171
}
72-
73-
74-
75-

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/From.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@
1616
package org.springframework.data.relational.core.sql;
1717

1818
import java.util.Arrays;
19-
import java.util.Collections;
2019
import java.util.List;
2120

22-
import org.springframework.util.Assert;
2321
import org.springframework.util.StringUtils;
2422

2523
/**
2624
* {@code FROM} clause.
2725
*
2826
* @author Mark Paluch
27+
* @since 1.1
2928
*/
3029
public class From extends AbstractSegment {
3130

@@ -37,7 +36,7 @@ public class From extends AbstractSegment {
3736

3837
From(List<Table> tables) {
3938

40-
super(tables.toArray(new Table[]{}));
39+
super(tables.toArray(new Table[] {}));
4140

4241
this.tables = tables;
4342
}

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/Functions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* Factory for common {@link Expression function expressions}.
2626
*
2727
* @author Mark Paluch
28+
* @since 1.1
2829
* @see SQL
2930
* @see Expressions
3031
* @see Functions
@@ -59,6 +60,5 @@ public static SimpleFunction count(Collection<? extends Expression> columns) {
5960
}
6061

6162
// Utility constructor.
62-
private Functions() {
63-
}
63+
private Functions() {}
6464
}

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/In.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
*
2929
* @author Jens Schauder
3030
* @author Mark Paluch
31+
* @since 1.1
3132
*/
3233
public class In extends AbstractSegment implements Condition {
3334

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/IsNull.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
* {@code IS NULL} {@link Condition}.
2222
*
2323
* @author Jens Schauder
24+
* @since 1.1
2425
*/
2526
public class IsNull extends AbstractSegment implements Condition {
2627

2728
private final Expression expression;
28-
2929
private final boolean negated;
3030

3131
private IsNull(Expression expression) {

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/Join.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
* {@link Segment} for a {@code JOIN} declaration.
2020
* <p/>
2121
* Renders to: {@code JOIN
22-
* <table>
22+
*
23+
<table>
2324
* ON <condition>}.
2425
*
2526
* @author Mark Paluch
27+
* @since 1.1
2628
*/
2729
public class Join extends AbstractSegment {
2830

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/Like.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* Results in a rendered condition: {@code <left> LIKE <right>}.
2424
*
2525
* @author Mark Paluch
26+
* @since 1.1
2627
*/
2728
public class Like extends AbstractSegment implements Condition {
2829

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/MultipleCondition.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
* Wrapper for multiple {@link Condition}s.
2424
*
2525
* @author Jens Schauder
26+
* @since 1.1
2627
*/
2728
public abstract class MultipleCondition extends AbstractSegment implements Condition {
2829

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/Named.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* Named element exposing a {@link #getName() name}.
2020
*
2121
* @author Mark Paluch
22+
* @since 1.1
2223
*/
2324
public interface Named {
2425

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/Not.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
/**
1919
* @author Jens Schauder
20+
* @since 1.1
2021
*/
2122
public class Not extends AbstractSegment implements Condition {
2223

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/OrCondition.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* {@link Condition} representing an {@code OR} relation between two {@link Condition}s.
2020
*
2121
* @author Mark Paluch
22+
* @since 1.1
2223
* @see Condition#or(Condition)
2324
*/
2425
public class OrCondition extends MultipleCondition {

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/OrderByField.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@
2525
* Represents a field in the {@code ORDER BY} clause.
2626
*
2727
* @author Mark Paluch
28+
* @since 1.1
2829
*/
2930
public class OrderByField extends AbstractSegment {
3031

3132
private final Expression expression;
3233
private final @Nullable Sort.Direction direction;
3334
private final Sort.NullHandling nullHandling;
3435

35-
OrderByField(Expression expression, @Nullable Direction direction, NullHandling nullHandling) {
36+
private OrderByField(Expression expression, @Nullable Direction direction, NullHandling nullHandling) {
3637

3738
super(expression);
3839
Assert.notNull(expression, "Order by expression must not be null");

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/SQL.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
import org.springframework.util.Assert;
2020

2121
/**
22-
* Utility to create SQL {@link Segment}s. Typically used as entry point to the Statement Builder.
23-
* Objects and dependent objects created by the Query AST are immutable except for builders.
24-
* <p/>The Statement Builder API is intended for framework usage to produce SQL required for framework operations.
22+
* Utility to create SQL {@link Segment}s. Typically used as entry point to the Statement Builder. Objects and dependent
23+
* objects created by the Query AST are immutable except for builders.
24+
* <p/>
25+
* The Statement Builder API is intended for framework usage to produce SQL required for framework operations.
2526
*
2627
* @author Mark Paluch
2728
* @author Jens Schauder
29+
* @since 1.1
2830
* @see Expressions
2931
* @see Conditions
3032
* @see Functions
@@ -76,6 +78,5 @@ public static BindMarker bindMarker(String name) {
7678
}
7779

7880
// Utility constructor.
79-
private SQL() {
80-
}
81+
private SQL() {}
8182
}

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/Segment.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
package org.springframework.data.relational.core.sql;
1717

1818
/**
19-
* Supertype of all Abstract Syntax Tree (AST) segments. Segments are typically immutable and mutator methods return new instances instead of changing the called instance.
19+
* Supertype of all Abstract Syntax Tree (AST) segments. Segments are typically immutable and mutator methods return new
20+
* instances instead of changing the called instance.
2021
*
2122
* @author Mark Paluch
23+
* @since 1.1
2224
*/
2325
public interface Segment extends Visitable {
2426

@@ -28,16 +30,16 @@ public interface Segment extends Visitable {
2830
* Equality is typically given if the {@link #toString()} representation matches.
2931
*
3032
* @param other the reference object with which to compare.
31-
* @return {@literal true} if this object is the same as the {@code other}
32-
* argument; {@literal false} otherwise.
33+
* @return {@literal true} if this object is the same as the {@code other} argument; {@literal false} otherwise.
3334
*/
3435
@Override
3536
boolean equals(Object other);
3637

3738
/**
3839
* Generate a hash code from this{@link Segment}.
3940
* <p/>
40-
* Hashcode typically derives from the {@link #toString()} representation so two {@link Segment}s yield the same {@link #hashCode()} if their {@link #toString()} representation matches.
41+
* Hashcode typically derives from the {@link #toString()} representation so two {@link Segment}s yield the same
42+
* {@link #hashCode()} if their {@link #toString()} representation matches.
4143
*
4244
* @return a hash code value for this object.
4345
*/
@@ -47,7 +49,9 @@ public interface Segment extends Visitable {
4749
/**
4850
* Return a SQL string representation of this {@link Segment}.
4951
* <p/>
50-
* The representation is intended for debugging purposes and an approximation to the generated SQL. While it might work in the context of a specific dialect, you should not that the {@link #toString()} representation works across multiple databases.
52+
* The representation is intended for debugging purposes and an approximation to the generated SQL. While it might
53+
* work in the context of a specific dialect, you should not that the {@link #toString()} representation works across
54+
* multiple databases.
5155
*
5256
* @return a SQL string representation of this {@link Segment}.
5357
*/

spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/Select.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818
import java.util.OptionalLong;
1919

2020
/**
21-
* AST for a {@code SELECT} statement.
22-
* Visiting order:
21+
* AST for a {@code SELECT} statement. Visiting order:
2322
* <ol>
2423
* <li>Self</li>
25-
* <li>{@link Column SELECT columns} </li>
24+
* <li>{@link Column SELECT columns}</li>
2625
* <li>{@link Table FROM tables} clause</li>
2726
* <li>{@link Join JOINs}</li>
2827
* <li>{@link Condition WHERE} condition</li>
2928
* <li>{@link OrderByField ORDER BY fields}</li>
3029
* </ol>
3130
*
3231
* @author Mark Paluch
32+
* @since 1.1
3333
* @see StatementBuilder
3434
* @see SelectBuilder
3535
* @see SQL

0 commit comments

Comments
 (0)