001/*
002 * #%L
003 * HAPI FHIR - Core Library
004 * %%
005 * Copyright (C) 2014 - 2024 Smile CDR, Inc.
006 * %%
007 * Licensed under the Apache License, Version 2.0 (the "License");
008 * you may not use this file except in compliance with the License.
009 * You may obtain a copy of the License at
010 *
011 *      http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 * #L%
019 */
020package ca.uhn.fhir.rest.gclient;
021
022public interface ISort<T> {
023
024        /**
025         * Sort ascending
026         */
027        IQuery<T> ascending(IParam theParam);
028
029        /**
030         * Sort ascending
031         *
032         * @param theParam The param name, e.g. "address"
033         */
034        IQuery<T> ascending(String theParam);
035
036        /**
037         * Sort by the default order. Note that as of STU3, there is no longer
038         * a concept of default order, only ascending and descending. This method
039         * technically implies "ascending" but it makes more sense to use
040         * {@link #ascending(IParam)}
041         */
042        IQuery<T> defaultOrder(IParam theParam);
043
044        /**
045         * Sort by the default order. Note that as of STU3, there is no longer
046         * a concept of default order, only ascending and descending. This method
047         * technically implies "ascending" but it makes more sense to use
048         * {@link #ascending(IParam)}
049         */
050        IQuery<T> defaultOrder(String theParam);
051
052        /**
053         * Sort descending
054         *
055         * @param theParam A query param - Could be a constant such as <code>Patient.ADDRESS</code> or a custom
056         *                 param such as <code>new StringClientParam("foo")</code>
057         */
058        IQuery<T> descending(IParam theParam);
059
060        /**
061         * Sort ascending
062         *
063         * @param theParam The param name, e.g. "address"
064         */
065        IQuery<T> descending(String theParam);
066}