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

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

import de.ivu.elect.business.gebietsbaum.entity.Gebietsart;

public class LambdaGebietsartSelectOneMenuProperty extends AbstractGebietsartSelectOneMenuProperty {

  private final Consumer<Gebietsart> setter;

  private final Supplier<Gebietsart> getter;

  public LambdaGebietsartSelectOneMenuProperty(List<Gebietsart> values, Consumer<Gebietsart> setter,
      Supplier<Gebietsart> getter) {
    super(values);
    this.setter = setter;
    this.getter = getter;
  }

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

  @Override
  public void setValue(Gebietsart gebietsart) {
    setter.accept(gebietsart);
  }

  @Override
  public boolean hasNoSelectionItem() {
    return true;
  }

  @Override
  public String getNoSelectionLabel() {
    return this.getMessage("component.selection.required");
  }
}
