Skip to contentPackage: ExtendedFinderSupport
ExtendedFinderSupport
Coverage
1: /*
2: * *************************************************************************************************************************************************************
3: *
4: * TheseFoolishThings: Miscellaneous utilities
5: * http://tidalwave.it/projects/thesefoolishthings
6: *
7: * Copyright (C) 2009 - 2024 by Tidalwave s.a.s. (http://tidalwave.it)
8: *
9: * *************************************************************************************************************************************************************
10: *
11: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
12: * You may obtain a copy of the License at
13: *
14: * http://www.apache.org/licenses/LICENSE-2.0
15: *
16: * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
17: * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
18: *
19: * *************************************************************************************************************************************************************
20: *
21: * git clone https://bitbucket.org/tidalwave/thesefoolishthings-src
22: * git clone https://github.com/tidalwave-it/thesefoolishthings-src
23: *
24: * *************************************************************************************************************************************************************
25: */
26: package it.tidalwave.util.spi;
27:
28: import javax.annotation.Nonnegative;
29: import javax.annotation.Nonnull;
30: import it.tidalwave.util.Finder;
31:
32: /***************************************************************************************************************************************************************
33: *
34: * A utility interface for creating extended {@link Finder}s, it provides automatic covariant return types. Make your
35: * extended {@code Finder} interface to extend from this. For instance, a custom {@code Date} finder can be declared as:
36: *
37: * <pre>
38: * public interface DateFinder extends ExtendedFinderSupport<SomeClass, DateFinder>
39: * {
40: * public DateFinder before (Date date);
41: *
42: * public DateFinder after (Date date);
43: * }
44: * </pre>
45: *
46: * @author Fabrizio Giudici
47: * @it.tidalwave.javadoc.draft
48: *
49: **************************************************************************************************************************************************************/
50: // START SNIPPET: declaration
51: public interface ExtendedFinderSupport<T, F extends Finder<T>> extends Finder<T>
52: {
53: /** {@inheritDoc} */
54: @Override @Nonnull
55: public F from (@Nonnegative int firstResult);
56:
57: /** {@inheritDoc} */
58: @Override @Nonnull
59: public F max (@Nonnegative int maxResults);
60:
61: /** {@inheritDoc} */
62: @Override @Nonnull
63: public F sort (@Nonnull SortCriterion criterion);
64:
65: /** {@inheritDoc} */
66: @Override @Nonnull
67: public F sort (@Nonnull SortCriterion criterion, @Nonnull SortDirection direction);
68:
69: /** {@inheritDoc} */
70: @Override @Nonnull
71: public F withContext (@Nonnull Object context);
72: }
73: // END SNIPPET: declaration
74: