package de.ivu.elect.presentation.wahl.form;

import java.util.List;
import java.util.function.Consumer;
import java.util.function.Supplier;

import de.ivu.elect.business.wahl.entity.Wahlart;

/**
 *  on 09.08.2016.
 */
public class LambdaWahlartSelectOneMenuProperty extends AbstractWahlartSelectOneMenuProperty {

  private final Consumer<Wahlart> setter;

  private final Supplier<Wahlart> getter;

  public LambdaWahlartSelectOneMenuProperty(List<Wahlart> wahlarten, Consumer<Wahlart> setter, Supplier<Wahlart> getter) {
    super(wahlarten);
    this.setter = setter;
    this.getter = getter;
  }

  @Override
  public Wahlart getValue() {
    return getter.get();
  }

  @Override
  public void setValue(Wahlart wahlart) {
    setter.accept(wahlart);
  }
}
