Error OsidList Pattern

An OsidList that always throws — propagate an exception through an OsidList boundary.

Overview

An error list holds an OperationFailedException and re-throws it on the first call to getNext(). It lets you return a well-typed OsidList from a method signature while signaling that the underlying query failed — keeping the error deferred until the caller actually tries to consume the list.

hasNext() returns false and available() returns 0, so callers that check before consuming will skip the list cleanly.

Javadoc Reference

net.okapia.osid.jamocha.spi

Class Declaration Pattern

public final class ErrorOsidObjectList
extends Object
implements OsidObjectList

Constructor Pattern

ErrorOsidObjectList(OperationFailedException cause)
ParameterTypeDescription
cause OperationFailedException the exception to re-throw on iteration

Static Factory Method Pattern

static OsidObjectList of(OperationFailedException cause)
ParameterTypeDescription
cause OperationFailedException the exception to carry

Returns OsidObjectList