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

org.opentripplanner.transit.model.framework.TransitObject Maven / Gradle / Ivy

There is a newer version: 2.6.0
Show newest version
package org.opentripplanner.transit.model.framework;

import java.io.Serializable;
import javax.annotation.Nonnull;

public interface TransitObject, T extends TransitBuilder>
  extends Serializable {
  /**
   * Return {@code true} if this is the same as the given other objects, all fields must have
   * the same value. This is used to avoid creating new objects during transit model construction
   * and during RealTime updates.
   */
  boolean sameAs(@Nonnull E other);

  /**
   * The copy method is used to mutate the existing object by creating a builder and setting
   * {@code this} as the "original".
   * 

* Note! Do not mutate nested transit entities. When crossing aggregate root boundaries, then * you need to fetch the entity from the transit service before changing it. Changing a nested * entity will cause the data to become inconsistent. *

* The exception is when a builder reference another builder, and not the entity object. The * nested entity is a composed part of the parent, and not shared with other entities. *

* TODO RTM - Document design "rules" in a package readme, when the design is set. */ @Nonnull TransitBuilder copy(); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy