|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.s4.base.Event
public class Event
The base event class in S4. The base class supports generic key/value pairs which us useful for rapid prototyping and for inter-application communication. For greater efficiency and type safety, extend this class to create custom event types.
Constructor Summary | |
---|---|
Event()
Default constructor sets time using system time. |
|
Event(long time)
This constructor explicitly sets the time. |
Method Summary | ||
---|---|---|
boolean |
containsKey(java.lang.String key)
|
|
java.lang.String |
get(java.lang.String key)
Returns the value for key as a String. |
|
|
get(java.lang.String key,
java.lang.Class<T> type)
Get value for key. |
|
int |
getAppId()
All events must be assigned the unique App ID of the App that owns the stream to which this event is injected. |
|
java.util.Map<java.lang.String,java.lang.String> |
getAttributesAsMap()
|
|
java.lang.String |
getStreamName()
The stream id is used to identify streams uniquely in a cluster configuration. |
|
long |
getTime()
|
|
boolean |
hasAttributes()
|
|
|
put(java.lang.String key,
java.lang.Class<T> type,
T value)
Put an arbitrary key-value pair in the event. |
|
void |
setAppId(int appId)
All events must be assigned the unique App ID of the App that owns the stream to which this event is injected. |
|
void |
setStreamId(java.lang.String streamName)
|
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Event()
public Event(long time)
Method Detail |
---|
public long getTime()
public java.lang.String getStreamName()
public void setStreamId(java.lang.String streamName)
streamName
- used to identify streams uniquely in a cluster configuration. It is not required to operate in local
mode.public int getAppId()
public void setAppId(int appId)
appId
- a unique application identifier, typically assigned by the deployment system.public <T> void put(java.lang.String key, java.lang.Class<T> type, T value)
type
- the type of the valuekey
- the keyvalue
- the valuepublic <T> T get(java.lang.String key, java.lang.Class<T> type)
key
-
public java.lang.String get(java.lang.String key)
key
-
public boolean hasAttributes()
public boolean containsKey(java.lang.String key)
public java.util.Map<java.lang.String,java.lang.String> getAttributesAsMap()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |