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

de.focus_shift.jollyday.jackson.JacksonHolidays Maven / Gradle / Ivy

The newest version!
package de.focus_shift.jollyday.jackson;

import de.focus_shift.jollyday.core.spi.ChristianHoliday;
import de.focus_shift.jollyday.core.spi.EthiopianOrthodoxHoliday;
import de.focus_shift.jollyday.core.spi.Fixed;
import de.focus_shift.jollyday.core.spi.FixedWeekdayBetweenFixed;
import de.focus_shift.jollyday.core.spi.FixedWeekdayInMonth;
import de.focus_shift.jollyday.core.spi.FixedWeekdayRelativeToFixed;
import de.focus_shift.jollyday.core.spi.IslamicHoliday;
import de.focus_shift.jollyday.core.spi.RelativeToEasterSunday;
import de.focus_shift.jollyday.core.spi.RelativeToFixed;
import de.focus_shift.jollyday.core.spi.RelativeToWeekdayInMonth;
import de.focus_shift.jollyday.jackson.mapping.Holidays;

import java.util.List;

import static java.util.stream.Collectors.toList;

public class JacksonHolidays implements de.focus_shift.jollyday.core.spi.Holidays {

  private final Holidays holidays;

  public JacksonHolidays(Holidays holidays) {
    this.holidays = holidays;
  }

  @Override
  public List fixed() {
    return holidays.getFixed().stream().map(JacksonFixed::new).collect(toList());
  }

  @Override
  public List relativeToFixed() {
    return holidays.getRelativeToFixed().stream().map(JacksonRelativeToFixed::new).collect(toList());
  }

  @Override
  public List relativeToWeekdayInMonth() {
    return holidays.getRelativeToWeekdayInMonth().stream().map(JacksonRelativeToWeekdayInMonth::new).collect(toList());
  }

  @Override
  public List fixedWeekdays() {
    return holidays.getFixedWeekday().stream().map(JacksonFixedWeekdayInMonth::new).collect(toList());
  }

  @Override
  public List christianHolidays() {
    return holidays.getChristianHoliday().stream().map(JacksonChristianHoliday::new).collect(toList());
  }

  @Override
  public List islamicHolidays() {
    return holidays.getIslamicHoliday().stream().map(JacksonIslamicHoliday::new).collect(toList());
  }

  @Override
  public List fixedWeekdayBetweenFixed() {
    return holidays.getFixedWeekdayBetweenFixed().stream().map(JacksonFixedWeekdayBetweenFixed::new).collect(toList());
  }

  @Override
  public List fixedWeekdayRelativeToFixed() {
    return holidays.getFixedWeekdayRelativeToFixed().stream().map(JacksonFixedWeekdayRelativeToFixed::new).collect(toList());
  }

  @Override
  public List ethiopianOrthodoxHolidays() {
    return holidays.getEthiopianOrthodoxHoliday().stream().map(JacksonEthiopianOrthodoxHoliday::new).collect(toList());
  }

  @Override
  public List relativeToEasterSunday() {
    return holidays.getRelativeToEasterSunday().stream().map(JacksonRelativeToEasterSunday::new).collect(toList());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy