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

org.opentripplanner.ext.transmodelapi.model.PlanResponse Maven / Gradle / Ivy

package org.opentripplanner.ext.transmodelapi.model;

import org.opentripplanner.api.common.Message;
import org.opentripplanner.api.resource.DebugOutput;
import org.opentripplanner.model.plan.TripPlan;
import org.opentripplanner.routing.api.response.TripSearchMetadata;
import org.opentripplanner.util.ResourceBundleSingleton;

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

public class PlanResponse {
    public TripPlan plan;
    public TripSearchMetadata metadata;
    public List messages = new ArrayList<>();
    public DebugOutput debugOutput;


    @Override
    public String toString() {
        return  "PlanResponse{"
                + "plan=" + plan
                + ", metadata=" + metadata
                + ", messages=" + messages
                + ", debugOutput=" + debugOutput
                + '}';
    }

    public List listErrorMessages(String locale) {
        return messages
                .stream()
                .map(message -> message.get(ResourceBundleSingleton.INSTANCE.getLocale(locale)))
                .collect(Collectors.toList());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy