All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.seedstack.business.finder.Result Maven / Gradle / Ivy

The newest version!
/*
 * Copyright © 2013-2024, The SeedStack authors 
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package org.seedstack.business.finder;

import java.util.List;

/**
 * Symbolises a ranged result of representation retrieved from the persistence. It exposes:
 * 
    *
  • The list: {@code getResult()},
  • *
  • The list size: {@code getResultSize()},
  • *
  • The full size of the whole request: {@code getFullSizeRequest()}.
  • *
* * @param the representation type */ @Deprecated public final class Result { private final List list; private final long fullSize; private final long offset; /** * Constructor. * * @param list the list of item * @param offset the offset * @param fullSize the total number of item available */ public Result(List list, long offset, long fullSize) { this.list = list; this.offset = offset; this.fullSize = fullSize; } /** * Creates a new Result. * * @param result the list of item * @param offset the offset * @param fullRequestSize the number of item available * @param the item type * @return the result range */ public static Result rangeResult(List result, long offset, long fullRequestSize) { return new Result<>(result, offset, fullRequestSize); } /** * Returns the items. * * @return the list of items */ public List getResult() { return this.list; } /** * Returns the size. * * @return the number of item returned */ public int getSize() { return this.list.size(); } /** * Returns the full size. * * @return the total number of item available */ public long getFullSize() { return this.fullSize; } /** * Returns the offset. * * @return the offset */ public long getOffset() { return this.offset; } }