Class SingleViewIterator<T>
java.lang.Object
net.fabricmc.fabric.api.transfer.v1.storage.base.SingleViewIterator<T>
- Type Parameters:
T- The type of the stored resource.
- All Implemented Interfaces:
Iterator<StorageView<T>>,TransactionContext.CloseCallback
@Experimental
@Deprecated
public final class SingleViewIterator<T>
extends Object
implements Iterator<StorageView<T>>, TransactionContext.CloseCallback
Deprecated.
Experimental feature, we reserve the right to remove or change it without further notice.
The transfer API is a complex addition, and we want to be able to correct possible design mistakes.
An iterator for a single
StorageView, tied to a transaction. Instances can be created with create(net.fabricmc.fabric.api.transfer.v1.storage.StorageView<T>, net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext).
This class should only be used by implementors of Storage.iterator(net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext), that wish to expose a single storage view.
In that case, usage of this class is recommended, as it will ensure that the storage view can't be accessed after the transaction is closed.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Iterator<StorageView<T>>create(StorageView<T> view, TransactionContext transaction)Deprecated.Create a new iterator for the passed storage view, tied to the passed transaction.booleanhasNext()Deprecated.next()Deprecated.voidonClose(TransactionContext transaction, TransactionContext.Result result)Deprecated.Perform an action when a transaction is closed.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Method Details
-
create
public static <T> Iterator<StorageView<T>> create(StorageView<T> view, TransactionContext transaction)Deprecated.Create a new iterator for the passed storage view, tied to the passed transaction.The iterator will ensure that it can only be used as long as the transaction is open.
-
hasNext
public boolean hasNext()Deprecated. -
next
Deprecated. -
onClose
Deprecated.Description copied from interface:TransactionContext.CloseCallbackPerform an action when a transaction is closed.- Specified by:
onClosein interfaceTransactionContext.CloseCallback- Parameters:
transaction- The closed transaction. OnlyTransactionContext.nestingDepth(),TransactionContext.getOpenTransaction(int)andTransactionContext.addOuterCloseCallback(net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext.OuterCloseCallback)may be called on that transaction.TransactionContext.addCloseCallback(net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext.CloseCallback)may additionally be called on parent transactions (accessed throughTransactionContext.getOpenTransaction(int)for lower nesting depths).result- The result of this transaction: whether it was committed or aborted.
-