package de.ivu.elect.business;

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

import de.ivu.elect.jee.entity.EntityUtil;

public class AttributeCopy {

  public static <T> boolean copyAttribute(Supplier<T> getterSource, Consumer<T> setterTarget, Supplier<T> getterTarget) {
    T newValue = getterSource.get();


    boolean verschieden = !EntityUtil.compareObjects(newValue, getterTarget.get());
    if (verschieden) {
      setterTarget.accept(newValue);
    }
    return verschieden;
  }

}
