Skip to content

Commit 7d49697

Browse files
committed
DATACMNS-1058 - Polishing.
Improve Javadoc. Extend year range in license header. Original pull request: #214.
1 parent 0ff53bd commit 7d49697

File tree

2 files changed

+44
-23
lines changed

2 files changed

+44
-23
lines changed

src/main/java/org/springframework/data/domain/PageRequest.java

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2008-2014 the original author or authors.
2+
* Copyright 2008-2017 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.
@@ -15,13 +15,11 @@
1515
*/
1616
package org.springframework.data.domain;
1717

18-
import java.util.Optional;
19-
2018
import org.springframework.data.domain.Sort.Direction;
2119

2220
/**
2321
* Basic Java Bean implementation of {@code Pageable}.
24-
*
22+
*
2523
* @author Oliver Gierke
2624
* @author Thomas Darimont
2725
*/
@@ -34,7 +32,7 @@ public class PageRequest extends AbstractPageRequest {
3432
/**
3533
* Creates a new {@link PageRequest}. Pages are zero indexed, thus providing 0 for {@code page} will return the first
3634
* page.
37-
*
35+
*
3836
* @param page zero-based page index.
3937
* @param size the size of the page to be returned.
4038
* @deprecated use {@link #of(int, int)} instead.
@@ -46,7 +44,7 @@ public PageRequest(int page, int size) {
4644

4745
/**
4846
* Creates a new {@link PageRequest} with sort parameters applied.
49-
*
47+
*
5048
* @param page zero-based page index.
5149
* @param size the size of the page to be returned.
5250
* @param direction the direction of the {@link Sort} to be specified, can be {@literal null}.
@@ -60,11 +58,11 @@ public PageRequest(int page, int size, Direction direction, String... properties
6058

6159
/**
6260
* Creates a new {@link PageRequest} with sort parameters applied.
63-
*
61+
*
6462
* @param page zero-based page index.
6563
* @param size the size of the page to be returned.
6664
* @param sort can be {@literal null}.
67-
* @deprecated use {@link #of(int, int, Optional)} instead.
65+
* @deprecated since 2.0, use {@link #of(int, int, Sort)} instead.
6866
*/
6967
@Deprecated
7068
public PageRequest(int page, int size, Sort sort) {
@@ -74,14 +72,38 @@ public PageRequest(int page, int size, Sort sort) {
7472
this.sort = sort;
7573
}
7674

77-
public static PageRequest of(int page, int site) {
78-
return of(page, site, Sort.unsorted());
75+
/**
76+
* Creates a new unsorted {@link PageRequest}.
77+
*
78+
* @param page zero-based page index.
79+
* @param size the size of the page to be returned.
80+
* @since 2.0
81+
*/
82+
public static PageRequest of(int page, int size) {
83+
return of(page, size, Sort.unsorted());
7984
}
8085

81-
public static PageRequest of(int page, int site, Sort sort) {
82-
return new PageRequest(page, site, sort);
86+
/**
87+
* Creates a new {@link PageRequest} with sort parameters applied.
88+
*
89+
* @param page zero-based page index.
90+
* @param size the size of the page to be returned.
91+
* @param sort must not be {@literal null}.
92+
* @since 2.0
93+
*/
94+
public static PageRequest of(int page, int size, Sort sort) {
95+
return new PageRequest(page, size, sort);
8396
}
8497

98+
/**
99+
* Creates a new {@link PageRequest} with sort direction and properties applied.
100+
*
101+
* @param page zero-based page index.
102+
* @param size the size of the page to be returned.
103+
* @param direction must not be {@literal null}.
104+
* @param properties must not be {@literal null}.
105+
* @since 2.0
106+
*/
85107
public static PageRequest of(int page, int size, Direction direction, String... properties) {
86108
return of(page, size, Sort.by(direction, properties));
87109
}
@@ -94,23 +116,23 @@ public Sort getSort() {
94116
return sort;
95117
}
96118

97-
/*
119+
/*
98120
* (non-Javadoc)
99121
* @see org.springframework.data.domain.Pageable#next()
100122
*/
101123
public Pageable next() {
102124
return new PageRequest(getPageNumber() + 1, getPageSize(), getSort());
103125
}
104126

105-
/*
127+
/*
106128
* (non-Javadoc)
107129
* @see org.springframework.data.domain.AbstractPageRequest#previous()
108130
*/
109131
public PageRequest previous() {
110132
return getPageNumber() == 0 ? this : new PageRequest(getPageNumber() - 1, getPageSize(), getSort());
111133
}
112134

113-
/*
135+
/*
114136
* (non-Javadoc)
115137
* @see org.springframework.data.domain.Pageable#first()
116138
*/
@@ -147,7 +169,7 @@ public int hashCode() {
147169
return 31 * super.hashCode() + sort.hashCode();
148170
}
149171

150-
/*
172+
/*
151173
* (non-Javadoc)
152174
* @see java.lang.Object#toString()
153175
*/

src/main/java/org/springframework/data/repository/query/RepositoryQuery.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,23 @@
1717

1818
/**
1919
* Interface for a query abstraction.
20-
*
20+
*
2121
* @author Oliver Gierke
2222
*/
2323
public interface RepositoryQuery {
2424

2525
/**
2626
* Executes the {@link RepositoryQuery} with the given parameters.
27-
*
28-
* @param store
27+
*
2928
* @param parameters
3029
* @return
3130
*/
32-
public Object execute(Object[] parameters);
31+
Object execute(Object[] parameters);
3332

3433
/**
3534
* Returns the
36-
*
35+
*
3736
* @return
3837
*/
39-
public QueryMethod getQueryMethod();
40-
}
38+
QueryMethod getQueryMethod();
39+
}

0 commit comments

Comments
 (0)