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

org.opentripplanner.api.mapping.SystemNoticeMapper Maven / Gradle / Ivy

package org.opentripplanner.api.mapping;

import org.opentripplanner.api.model.ApiSystemNotice;
import org.opentripplanner.model.SystemNotice;

import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

public final class SystemNoticeMapper {

    private SystemNoticeMapper() {}

    public static List mapSystemNotices(Collection domainList) {
        // Using {@code null} and not an empty set will minimize the JSON removing the
        // {@code systemNotices} from the result.
        if (domainList == null || domainList.isEmpty()) {
            return null;
        }

        return domainList.stream().map(SystemNoticeMapper::mapSystemNotice).collect(Collectors.toList());
    }

    public static ApiSystemNotice mapSystemNotice(SystemNotice domain) {
        return new ApiSystemNotice(domain.tag, domain.text);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy