Sequenceablepublic final class InnerEvent extends Object implements Sequenceable
EventHandler.
An InnerEvent object contains an extra integer field and an extra object field to carry specific data.
The constructor of InnerEvent is private. Therefore, you need to call the get() method to create
an InnerEvent instance. The method will pull InnerEvent instances from a pool of recycled objects.
Sequenceable.Producer<T>| 限定符和类型 | 字段 | 说明 |
|---|---|---|
int |
eventId |
Indicates the event ID, which identifies the event type and determines the event handler.
|
Object |
object |
Indicates the object carried in an
InnerEvent for passing data of any type. |
long |
param |
Indicates the long integer data carried in an
InnerEvent, which is used to pass simple data. |
static Sequenceable.Producer<InnerEvent> |
PRODUCER |
Creates a
InnerEvent instance from a Parcel. |
Courier |
replyTo |
Indicates the
Courier where replies to this inner event can be sent. |
int |
sendingUid |
Indicates the UID sending the inner event.
|
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
static InnerEvent |
copyFrom(InnerEvent oldInnerEvent) |
Creates an
InnerEvent by copying task, ID, and other information from an existing
InnerEvent. |
void |
drop() |
Releases an
InnerEvent instance. |
static InnerEvent |
get() |
Obtains an
InnerEvent instance. |
static InnerEvent |
get(int eventId) |
Obtains an
InnerEvent instance with the event ID specified. |
static InnerEvent |
get(int eventId,
long param) |
Obtains an
InnerEvent instance with the event ID and long integer data specified. |
static InnerEvent |
get(int eventId,
long param,
Object object) |
Obtains an
InnerEvent instance with the event ID and required data specified. |
static InnerEvent |
get(int eventId,
Object object) |
Obtains an
InnerEvent instance with the event ID and object specified. |
static InnerEvent |
get(Runnable task) |
Obtains an
InnerEvent instance that carries a specified task. |
static InnerEvent |
get(InnerEvent oldInnerEvent) |
Clones an
InnerEvent instance by copying the event ID, task, owner, and other information of an existing
InnerEvent instance to it. |
long |
getHandleTime() |
Obtains the time when this
InnerEvent was delivered. |
PacMap |
getPacMap() |
|
Runnable |
getTask() |
Obtains the
Runnable task that will be executed when this InnerEvent is handled. |
boolean |
isPriorityEqual(EventHandler.Priority priority) |
Checks whether the priority of this
InnerEvent is the same as the given priority. |
boolean |
marshalling(Parcel out) |
Marshals this
Sequenceable object into a Parcel. |
PacMap |
peekPacMap() |
Obtains the
PacMap object contained in this InnerEvent. |
void |
setPacMap(PacMap pacMap) |
Sets a
PacMap object in this InnerEvent. |
String |
toString() |
Returns a string representation of the object.
|
boolean |
unmarshalling(Parcel in) |
Unmarshals this
Sequenceable object from a Parcel. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waithasFileDescriptorpublic static final Sequenceable.Producer<InnerEvent> PRODUCER
InnerEvent instance from a Parcel.public int eventId
Each EventHandler has a unique namespace for storing event IDs. Therefore, event IDs of
different EventHandler objects do not affect each other even if the IDs are the same.
public Object object
InnerEvent for passing data of any type. It is usually
used to pass complex data.public long param
InnerEvent, which is used to pass simple data.public Courier replyTo
Courier where replies to this inner event can be sent.public int sendingUid
Courier.
Otherwise, the value is -1.public boolean isPriorityEqual(EventHandler.Priority priority)
InnerEvent is the same as the given priority.priority - Indicates the event priority.true if the priority of this event is the same as the given priority;
returns false otherwise.public static InnerEvent get()
InnerEvent instance.InnerEvent instance.public static InnerEvent copyFrom(InnerEvent oldInnerEvent) throws CloneNotSupportedException
InnerEvent by copying task, ID, and other information from an existing
InnerEvent.oldInnerEvent - Indicates the existing InnerEvent.InnerEvent object containing the copied data.CloneNotSupportedException - copy event errorpublic static InnerEvent get(int eventId, long param, Object object)
InnerEvent instance with the event ID and required data specified.eventId - Indicates the ID of the InnerEvent, which is used to identify the event type. You can
set it to any int value.param - Indicates the long integer data carried in this InnerEvent. You can set it to any
long value.object - Indicates the object carried in this InnerEvent.InnerEvent instance.public static InnerEvent get(int eventId)
InnerEvent instance with the event ID specified.eventId - Indicates the ID of the InnerEvent, which is used to identify the event type. You can
set it to any int value.InnerEvent instance.public static InnerEvent get(int eventId, long param)
InnerEvent instance with the event ID and long integer data specified.eventId - Indicates the ID of the InnerEvent, which is used to identify the event type. You can
set it to any int value.param - Indicates the long integer data carried in this InnerEvent. You can set it to any
long value.InnerEvent instance.public static InnerEvent get(int eventId, Object object)
InnerEvent instance with the event ID and object specified.eventId - Indicates the ID of the InnerEvent, which is used to identify the event type. You can
set it to any int value.object - Indicates the object carried in this InnerEvent.InnerEvent instance.public static InnerEvent get(Runnable task)
InnerEvent instance that carries a specified task.task - Indicates the Runnable task to be carried. This parameter cannot be null.InnerEvent instance.public void drop()
InnerEvent instance.
The InnerEvent instance cannot be used after being released.
public long getHandleTime()
InnerEvent was delivered. The time is the number of nanoseconds calculated
from the time when the device is started to the current time.InnerEvent.public static InnerEvent get(InnerEvent oldInnerEvent) throws CloneNotSupportedException
InnerEvent instance by copying the event ID, task, owner, and other information of an existing
InnerEvent instance to it.oldInnerEvent - Indicates the existing InnerEvent whose information is to be copied.InnerEvent instance.CloneNotSupportedException - Throws this exception if the specified object cannot be cloned.public PacMap getPacMap()
PacMap object contained in this InnerEvent or a
new PacMap object.
If the PacMap object is null, this method returns a new PacMap object.
PacMap object.public void setPacMap(PacMap pacMap)
PacMap object in this InnerEvent.pacMap - Indicates the PacMap object to set.public PacMap peekPacMap()
PacMap object contained in this InnerEvent.
This method is similar to getPacMap(). The difference is that this method returns
null directly, instead of returning a new PacMap object, if the PacMap
object in this InnerEvent is null.
PacMap object or null.public Runnable getTask()
Runnable task that will be executed when this InnerEvent is handled.Runnable task if this InnerEvent contains a task;
returns null otherwise.public boolean marshalling(Parcel out)
SequenceableSequenceable object into a Parcel.marshalling 在接口中 Sequenceableout - Indicates the Parcel object to which the Sequenceable
object will be marshaled..true if the marshalling is successful; returns false otherwise.public boolean unmarshalling(Parcel in)
SequenceableSequenceable object from a Parcel.unmarshalling 在接口中 Sequenceablein - Indicates the Parcel object into which the Sequenceable
object has been marshaled.true if the unmarshalling is successful; returns false otherwise.public String toString()
ObjecttoString method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())