org.opentripplanner.api.mapping.SystemNoticeMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of otp Show documentation
Show all versions of otp Show documentation
The OpenTripPlanner multimodal journey planning system
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);
}
}