
org.opentripplanner.raptor.spi.Flyweight 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
The newest version!
package org.opentripplanner.raptor.spi;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* This interface is used to tag methods which return flyweight objects. The implementation may
* choose not to implement the return type as a flyweight object, but the Raptor implementation
* is guaranteed to treat them as such - enabling the optimization.
*
* A flyweight object is a temporary view to the state of the callee, which the caller can access
* immediately after the object is returned, until the next method call to the callee is performed.
* Do not store a reference to flyweight objects and make sure you do not access the state after
* the next method call.
*
* The flyweight design pattern is used to avoid unnecessary object creation, and the flyweight
* object should be reused.
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.SOURCE)
public @interface Flyweight {
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy