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

nl.vpro.domain.api.DateRangeFacets Maven / Gradle / Ivy

Go to download

Contains the objects used by the Frontend API, like forms and result objects

There is a newer version: 8.3.3
Show newest version
/*
 * Copyright (C) 2013 All rights reserved
 * VPRO The Netherlands
 */
package nl.vpro.domain.api;

import lombok.Getter;
import lombok.Setter;

import java.time.Instant;
import java.util.*;

import javax.xml.bind.annotation.*;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import nl.vpro.domain.api.jackson.DateRangeFacetsToJson;

/**
 * @author Roelof Jan Koekoek
 * @since 2.0
 */
@XmlType(name = "dateRangeFacetsType", propOrder = {
    "ranges"})
@XmlAccessorType(XmlAccessType.FIELD)
@JsonSerialize(using = DateRangeFacetsToJson.Serializer.class)
@JsonDeserialize(using = DateRangeFacetsToJson.Deserializer.class)
public class DateRangeFacets extends AbstractFacet implements Facet {

    @XmlElements({
        @XmlElement(name = "interval", type = DateRangeInterval.class),
        @XmlElement(name = "preset", type = DateRangePreset.class),
        @XmlElement(name = "range", type = DateRangeFacetItem.class)
    })
    @JsonIgnore
    @Getter
    @Setter
    private List> ranges;

    public DateRangeFacets() {
    }

    @SafeVarargs
    public DateRangeFacets(RangeFacet... ranges) {
        if(ranges != null && ranges.length > 0) {
            this.ranges = Arrays.asList(ranges);
        }
    }

    @SafeVarargs
    public final void addRanges(RangeFacet... ranges) {
        if(this.ranges == null) {
            this.ranges = new ArrayList<>(ranges.length);
        }

        Collections.addAll(this.ranges, ranges);
    }

    @Override
    public T getFilter() {
        return this.filter;
    }

    @Override
    public void setFilter(T filter) {
        this.filter = filter;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy