class BgpRouteDiff implements Comparable<BgpRouteDiff> {

  public static SortedSet<BgpRouteDiff> routeDiffs(
      @Nullable BgpRoute route1, @Nullable BgpRoute route2) {
    if (route1 == null || route2 == null || route1.equals(route2)) {
      return ImmutableSortedSet.of();
    }

    checkArgument(
        route1
            .toBuilder()
            .setAsPath(route2.getAsPath())
            .setCommunities(route2.getCommunities())
            .setLocalPreference(route2.getLocalPreference())
            .setMetric(route2.getMetric())
            .build()
            .equals(route2),
        "routeDiffs only supports differences of fields: " + ROUTE_DIFF_FIELD_NAMES);

    return Stream.of(
            routeDiff(route1, route2, PROP_AS_PATH, BgpRoute::getAsPath),
            routeDiff(route1, route2, PROP_COMMUNITIES, BgpRoute::getCommunities),
            routeDiff(route1, route2, PROP_LOCAL_PREFERENCE, BgpRoute::getLocalPreference),
            routeDiff(route1, route2, PROP_METRIC, BgpRoute::getMetric))
        .filter(Optional::isPresent)
        .map(Optional::get)
        .collect(ImmutableSortedSet.toImmutableSortedSet(natural()));
  }

  public  BgpRouteDiff(String fieldName, String oldValue, String newValue);

}