Package org.robolectric.shadows
Class ShadowMessage
java.lang.Object
org.robolectric.shadows.ShadowMessage
- Direct Known Subclasses:
ShadowLegacyMessage
,ShadowPausedMessage
@Implements(value=android.os.Message.class,
shadowPicker=Picker.class)
public abstract class ShadowMessage
extends Object
The shadow API for
Message
.
Different shadow implementations will be used depending on the current LooperMode
. See
ShadowLegacyMessage
and ShadowPausedMessage
for details.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
The shadow Picker for this class -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract Message
getNext()
Convenience method to provide getter access to the private fieldMessage.next
.abstract void
Exposes the package-privateMessage.recycleUnchecked()
static void
reset()
Resets the static state of theMessage
class by emptying the message pool.abstract void
Convenience method to provide setter access to the private fieldMessage.next
.abstract void
Stores theRunnable
instance that has been scheduled to invoke this message.
-
Constructor Details
-
ShadowMessage
public ShadowMessage()
-
-
Method Details
-
recycleUnchecked
public abstract void recycleUnchecked()Exposes the package-privateMessage.recycleUnchecked()
-
setScheduledRunnable
Stores theRunnable
instance that has been scheduled to invoke this message. This is called when the message is enqueued byShadowLegacyMessageQueue.enqueueMessage(android.os.Message, long)
and is used when the message is recycled to ensure that the correctRunnable
instance is removed from the associated scheduler.- Parameters:
r
- theRunnable
instance that is scheduled to trigger this message.#if ($api >= 21) * @see #recycleUnchecked() #else * @see #recycle() #end
Only supported in
LooperMode.Mode.LEGACY
.
-
getNext
Convenience method to provide getter access to the private fieldMessage.next
.Only supported in
LooperMode.Mode.LEGACY
- Returns:
- The next message in the current message chain.
- See Also:
-
setNext
Convenience method to provide setter access to the private fieldMessage.next
.Only supported in
LooperMode.Mode.LEGACY
- Parameters:
next
- the new next message for the current message.- See Also:
-
reset
Resets the static state of theMessage
class by emptying the message pool.
-