Skip to content

Package: ExtendedFinderSupport

ExtendedFinderSupport

Coverage

1: /*
2: * *********************************************************************************************************************
3: *
4: * TheseFoolishThings: Miscellaneous utilities
5: * http://tidalwave.it/projects/thesefoolishthings
6: *
7: * Copyright (C) 2009 - 2023 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
12: * the License. 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
17: * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations under the License.
19: *
20: * *********************************************************************************************************************
21: *
22: * git clone https://bitbucket.org/tidalwave/thesefoolishthings-src
23: * git clone https://github.com/tidalwave-it/thesefoolishthings-src
24: *
25: * *********************************************************************************************************************
26: */
27: package it.tidalwave.util.spi;
28:
29: import javax.annotation.Nonnegative;
30: import javax.annotation.Nonnull;
31: import it.tidalwave.util.Finder;
32:
33: /***********************************************************************************************************************
34: *
35: * A utility interface for creating extended {@link Finder}s, it provides automatic covariant return types. Make your
36: * extended {@code Finder} interface to extend from this. For instance, a custom {@code Date} finder can be declared as:
37: *
38: * <pre>
39: * public interface DateFinder extends ExtendedFinderSupport<SomeClass, DateFinder>
40: * {
41: * public DateFinder before (Date date);
42: *
43: * public DateFinder after (Date date);
44: * }
45: * </pre>
46: *
47: * @author Fabrizio Giudici
48: * @it.tidalwave.javadoc.draft
49: *
50: **********************************************************************************************************************/
51: // START SNIPPET: declaration
52: public interface ExtendedFinderSupport<TYPE, EXTENDED_FINDER extends Finder<TYPE>> extends Finder<TYPE>
53: {
54: /** {@inheritDoc} */
55: @Override @Nonnull
56: public EXTENDED_FINDER from (@Nonnegative int firstResult);
57:
58: /** {@inheritDoc} */
59: @Override @Nonnull
60: public EXTENDED_FINDER max (@Nonnegative int maxResults);
61:
62: /** {@inheritDoc} */
63: @Override @Nonnull
64: public EXTENDED_FINDER sort (@Nonnull SortCriterion criterion);
65:
66: /** {@inheritDoc} */
67: @Override @Nonnull
68: public EXTENDED_FINDER sort (@Nonnull SortCriterion criterion, @Nonnull SortDirection direction);
69:
70: /** {@inheritDoc} */
71: @Override @Nonnull
72: public EXTENDED_FINDER withContext (@Nonnull Object context);
73: }
74: // END SNIPPET: declaration
75: