Skip to content

Commit 16931e5

Browse files
Sauyon Leesmowton
andcommitted
Add necessary stubs for Spring
Co-Authored-By: smowton <[email protected]>
1 parent fc7e062 commit 16931e5

File tree

13 files changed

+923
-0
lines changed

13 files changed

+923
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright 2008-2021 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.data.domain;
17+
18+
import java.util.Collections;
19+
import java.util.function.Function;
20+
21+
public interface Page<T> extends Slice<T> {
22+
static <T> Page<T> empty() {
23+
return null;
24+
}
25+
26+
static <T> Page<T> empty(Pageable pageable) {
27+
return null;
28+
}
29+
30+
int getTotalPages();
31+
32+
long getTotalElements();
33+
34+
<U> Page<U> map(Function<? super T, ? extends U> converter);
35+
36+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright 2008-2021 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.data.domain;
17+
18+
import java.util.Optional;
19+
20+
21+
public interface Pageable {
22+
static Pageable unpaged() {
23+
return null;
24+
}
25+
26+
static Pageable ofSize(int pageSize) {
27+
return null;
28+
}
29+
30+
default boolean isPaged() {
31+
return false;
32+
}
33+
34+
default boolean isUnpaged() {
35+
return false;
36+
}
37+
38+
int getPageNumber();
39+
40+
int getPageSize();
41+
42+
long getOffset();
43+
44+
Sort getSort();
45+
46+
default Sort getSortOr(Sort sort) {
47+
return null;
48+
}
49+
50+
Pageable next();
51+
52+
Pageable previousOrFirst();
53+
54+
Pageable first();
55+
56+
Pageable withPage(int pageNumber);
57+
58+
boolean hasPrevious();
59+
60+
default Optional<Pageable> toOptional() {
61+
return null;
62+
}
63+
64+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright 2014-2021 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.data.domain;
17+
18+
import java.util.List;
19+
import java.util.function.Function;
20+
21+
import org.springframework.data.util.Streamable;
22+
23+
public interface Slice<T> extends Streamable<T> {
24+
int getNumber();
25+
26+
int getSize();
27+
28+
int getNumberOfElements();
29+
30+
List<T> getContent();
31+
32+
boolean hasContent();
33+
34+
Sort getSort();
35+
36+
boolean isFirst();
37+
38+
boolean isLast();
39+
40+
boolean hasNext();
41+
42+
boolean hasPrevious();
43+
44+
default Pageable getPageable() {
45+
return null;
46+
}
47+
48+
Pageable nextPageable();
49+
50+
Pageable previousPageable();
51+
52+
<U> Slice<U> map(Function<? super T, ? extends U> converter);
53+
54+
default Pageable nextOrLastPageable() {
55+
return null;
56+
}
57+
58+
default Pageable previousOrFirstPageable() {
59+
return null;
60+
}
61+
62+
}

0 commit comments

Comments
 (0)