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

io.sphere.client.model.facets.DateTimeRangeFacetResult Maven / Gradle / Ivy

There is a newer version: 0.72.1
Show newest version
package io.sphere.client.model.facets;

import net.jcip.annotations.*;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.FluentIterable;

import java.util.List;

/** Aggregated counts for a DateTime range facet, returned as a part of {@link io.sphere.client.model.SearchResult}. */
@Immutable
public class DateTimeRangeFacetResult implements FacetResult {
    private ImmutableList items;

    /** A list of individual items for this date range facet and their respective counts. */
    public List getItems() {
        return items;
    }

    /** Parses dates returned by the backend as milliseconds into joda.DateTime instances. */
    public static DateTimeRangeFacetResult fromMilliseconds(RangeFacetResultRaw facetResult) {
        return new DateTimeRangeFacetResult(
                FluentIterable.from(facetResult.getItems()).transform(DateTimeRangeFacetItem.fromMilliseconds).toImmutableList());
    }

    private DateTimeRangeFacetResult(ImmutableList items) {
        this.items = items;
    }

    @Override
    public String toString() {
        return "DateTimeRangeFacetResult{" +
                "items=" + items +
                '}';
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy