Exemple #1
0
        /**
         * Creates a new {@link PageRequest} with sort parameters applied.
         *
         * @param page
         * @param size
         * @param sort can be {@literal null}.
         */

        public PageRequest(int page, int size, Sort sort)
        {
            if (page < 0)
            {
                throw new ArgumentException("Page index must not be less than zero!");
            }

            if (size < 0)
            {
                throw new ArgumentException("Page size must not be less than zero!");
            }

            Page = page;
            Size = size;
            Sort = sort;
        }
Exemple #2
0
        /// <summary>
        ///     Returns a new <seealso cref="Sort" /> consisting of the <seealso cref="Orders" />s of the current
        ///     <seealso cref="Sort" /> combined with the given
        /// </summary>
        /// <param name="sort">to be combined</param>
        /// <returns></returns>
        public Sort And(Sort sort)
        {
            if (sort == null)
            {
                return this;
            }

            IList<Order> these = new List<Order>(Orders);

            foreach (var order in sort.Orders)
            {
                these.Add(order);
            }

            return new Sort(these.ToArray());
        }