001package arez.spy; 002 003import javax.annotation.Nonnull; 004import javax.annotation.Nullable; 005 006/** 007 * Spy interface into transaction data. 008 */ 009public interface TransactionInfo 010{ 011 /** 012 * Return the name of the transaction. 013 * Transactions usually have the same name as the Action or Observer that triggered transaction. 014 * 015 * @return the name of the transaction. 016 */ 017 @Nonnull 018 String getName(); 019 020 /** 021 * Return true if the transaciton only allows reads, false if writes allowed. 022 * 023 * @return true if the transaciton only allows reads, false if writes allowed. 024 */ 025 boolean isReadOnly(); 026 027 /** 028 * Return the parent transaction if any. 029 * The parent transaction was the one that was active when this transaction began. 030 * 031 * @return the parent transaction if any. 032 */ 033 @Nullable 034 TransactionInfo getParent(); 035 036 /** 037 * Return true if this transaction is tracking observables accessed within the transaction. 038 * 039 * @return true if this transaction is tracking observables accessed within the transaction. 040 */ 041 boolean isTracking(); 042 043 /** 044 * Return the tracker associated with this transaction. 045 * This method should not be invoked unless {@link #isTracking()} returns true. 046 * 047 * @return the Observer that is tracker for this transaction. 048 */ 049 @Nonnull 050 ObserverInfo getTracker(); 051}