org.entur.gbfs.mapper.SystemPricingPlansAdditionalMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gbfs-mapper-java Show documentation
Show all versions of gbfs-mapper-java Show documentation
Enables mapping between different versions of GBFS (bidirectional)
package org.entur.gbfs.mapper;
import org.mapstruct.Context;
import java.util.List;
public class SystemPricingPlansAdditionalMapper {
List mapName(String value, @Context String language) {
if (value == null) {
return null;
}
return List.of(
new org.mobilitydata.gbfs.v3_0.system_pricing_plans.GBFSName()
.withText(value)
.withLanguage(language)
);
}
String mapNameInverse(List values, @Context String language) {
if (values == null) {
return null;
}
return values.stream()
.filter(name -> name.getLanguage().equals(language))
.map(org.mobilitydata.gbfs.v3_0.system_pricing_plans.GBFSName::getText)
.findFirst().orElse(null);
}
List mapDescription(String value, @Context String language) {
if (value == null) {
return null;
}
return List.of(
new org.mobilitydata.gbfs.v3_0.system_pricing_plans.GBFSDescription()
.withText(value)
.withLanguage(language)
);
}
String mapDescriptionInverse(List values, @Context String language) {
if (values == null) {
return null;
}
return values.stream()
.filter(name -> name.getLanguage().equals(language))
.map(org.mobilitydata.gbfs.v3_0.system_pricing_plans.GBFSDescription::getText)
.findFirst().orElse(null);
}
}