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

org.openlca.proto.io.output.SocialIndicatorWriter Maven / Gradle / Ivy

package org.openlca.proto.io.output;

import org.openlca.core.model.SocialIndicator;
import org.openlca.proto.ProtoSocialIndicator;
import org.openlca.proto.ProtoType;
import org.openlca.util.Strings;

public class SocialIndicatorWriter {

  private final WriterConfig config;

  public SocialIndicatorWriter(WriterConfig config) {
    this.config = config;
  }

  public ProtoSocialIndicator write(SocialIndicator indicator) {
    var proto = ProtoSocialIndicator.newBuilder();
    if (indicator == null)
      return proto.build();
    proto.setType(ProtoType.SocialIndicator);
    Out.map(indicator, proto);
		config.dep(indicator.activityQuantity, proto::setActivityQuantity);
    config.dep(indicator.activityUnit, proto::setActivityUnit);
    proto.setActivityVariable(Strings.orEmpty(indicator.activityVariable));
    proto.setEvaluationScheme(Strings.orEmpty(indicator.evaluationScheme));
    proto.setUnitOfMeasurement(Strings.orEmpty(indicator.unitOfMeasurement));
    return proto.build();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy