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

org.opentripplanner.ext.restapi.mapping.SystemNoticeMapper Maven / Gradle / Ivy

The newest version!
package org.opentripplanner.ext.restapi.mapping;

import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import org.opentripplanner.ext.restapi.model.ApiSystemNotice;
import org.opentripplanner.model.SystemNotice;

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 - 2025 Weber Informatics LLC | Privacy Policy