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

org.entur.gbfs.mapper.SystemAlertsAdditionalMapper Maven / Gradle / Ivy

There is a newer version: 2.0.16
Show newest version
package org.entur.gbfs.mapper;

import org.mapstruct.Context;

import java.util.List;

public class SystemAlertsAdditionalMapper {
    List mapUrl(String value, @Context String language) {
        if (value == null) {
            return null;
        }
        return List.of(
                new org.mobilitydata.gbfs.v3_0.system_alerts.GBFSUrl()
                        .withText(value)
                        .withLanguage(language)
        );
    }

    String mapUrlInverse(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_alerts.GBFSUrl::getText)
                .findFirst().orElse(null);
    }

    List mapSummary(String value, @Context String language) {
        if (value == null) {
            return null;
        }
        return List.of(
                new org.mobilitydata.gbfs.v3_0.system_alerts.GBFSSummary()
                        .withText(value)
                        .withLanguage(language)
        );
    }

    String mapSummaryInverse(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_alerts.GBFSSummary::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_alerts.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_alerts.GBFSDescription::getText)
                .findFirst().orElse(null);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy