Class Event
java.lang.Object
java.util.AbstractMap<Object,Object>
java.util.HashMap<Object,Object>
berlin.yuna.typemap.model.TypeMap
org.nanonative.nano.helper.event.model.Event
- All Implemented Interfaces:
berlin.yuna.typemap.model.TypeInfo<berlin.yuna.typemap.model.TypeMap>,berlin.yuna.typemap.model.TypeMapI<berlin.yuna.typemap.model.TypeMap>,Serializable,Cloneable,Map<Object,Object>
public class Event
extends berlin.yuna.typemap.model.TypeMap
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionacknowledge(Runnable response) async()async(boolean async) Sets the event to asynchronous mode, allowing the response to be handled by a listener.Sets the event to asynchronous mode, allowing the response to be handled by a listener.static EventasyncEventOf(Context context, int channelId) broadcast(boolean broadcast) channel()Returns the event name based on the channel ID.intchannelId(int channelId) Sets the channel ID of the event.intcontext()booleanerror()static Eventberlin.yuna.typemap.model.Type<Event> inthashCode()<T> Event<T> EventifPresentAck(int channelId, Class<T> clazz, Function<T, Object> consumer) ifPresentAck(int channelId, Consumer<Event> consumer) booleanbooleanisAsync()booleannameOrg()Returns the event name based on the original channel ID.nano()payload()<T> TSets the payload of the event.<T> Optional<T> payloadOpt(Class<T> type) response()<T> T<T> Optional<T> responseOpt(Class<T> type) send()Sends the event to the Nano instance for processing.toString()Methods inherited from class berlin.yuna.typemap.model.TypeMap
addR, convertAndMap, convertAndMap, mapOf, treeGetMethods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, newHashMap, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesMethods inherited from interface berlin.yuna.typemap.model.TypeInfo
addPath, addPathR, as, asArray, asArray, asAtomicBoolean, asAtomicBooleanOpt, asAtomicInteger, asAtomicIntegerOpt, asAtomicLong, asAtomicLongOpt, asBigDecimal, asBigDecimalOpt, asBigInteger, asBigIntegerOpt, asBoolean, asBooleanOpt, asBooleans, asByte, asByteOpt, asBytes, asCalendar, asCalendarOpt, asCalendars, asCharacter, asCharacterOpt, asCharacters, asCharset, asCharsetOpt, asCharsets, asDate, asDateOpt, asDates, asDouble, asDoubleOpt, asDoubles, asFile, asFileOpt, asFiles, asFloat, asFloatOpt, asFloats, asInet4Address, asInet4Addresses, asInet4AddressOpt, asInet6Address, asInet6Addresses, asInet6AddressOpt, asInetAddress, asInetAddresses, asInetAddressOpt, asInstant, asInstantOpt, asInstants, asInt, asIntOpt, asInts, asList, asList, asList, asLocalDate, asLocalDateOpt, asLocalDates, asLocalDateTime, asLocalDateTimeOpt, asLocalDateTimes, asLocalTime, asLocalTimeOpt, asLocalTimes, asLong, asLongOpt, asLongs, asMap, asMap, asMap, asMap, asMap, asMap, asNumber, asNumberOpt, asNumbers, asOffsetDateTime, asOffsetDateTimeOpt, asOffsetDateTimes, asOpt, asOpt, asPath, asPathOpt, asPaths, asShort, asShortOpt, asShorts, asSqlDate, asSqlDateOpt, asSqlDates, asString, asStringOpt, asStrings, asThrowable, asThrowableOpt, asThrowables, asTime, asTimeOpt, asTimes, asTimestamp, asTimestampOpt, asTimestamps, asURI, asURIOpt, asURIs, asURL, asURLOpt, asURLs, asUUID, asUUIDOpt, asUUIDs, asZonedDateTime, asZonedDateTimeOpt, asZonedDateTimes, containsPath, filter, flatMap, flatOpt, get, ifPresent, ifPresentOrElse, isEmpty, isPresent, map, or, orElse, orElseGet, orElseThrow, orElseThrow, putPath, putPathR, setPath, setPathR, stream, toJson, toJsonMethods inherited from interface berlin.yuna.typemap.model.TypeMapI
typeListOpt, typeMapOpt
-
Field Details
-
channelId
protected int channelId -
context
-
responseListener
-
payload
-
payloadRaw
-
response
-
error
-
EVENT_ORIGINAL_CHANNEL_ID
- See Also:
-
-
Constructor Details
-
Event
Constructs an instance of the Event class with specified type, context, payload, and response listener. This event object can be used to trigger specific actions or responses based on the event type and payload.- Parameters:
context- TheContextin which the event is created and processed. It provides environmental data and configurations.
-
-
Method Details
-
eventOf
-
asyncEventOf
-
channel
Returns the event name based on the channel ID.- Returns:
- The name of the event.
-
nameOrg
Returns the event name based on the original channel ID.- Returns:
- The name of the event.
-
nano
-
channelId
public int channelId()- Returns:
- The integer representing the type of the event. This typically corresponds to a specific kind of event.
-
channelIdOrg
public int channelIdOrg()- Returns:
- The integer representing the original type of the event. This typically corresponds to a specific kind of event.
-
channelId
Sets the channel ID of the event.- Parameters:
channelId- The integer representing the type of the event. This typically corresponds to a specific kind of event.- Returns:
- self for chaining
-
async
Sets the event to asynchronous mode, allowing the response to be handled by a listener.- Returns:
- self for chaining
-
async
Sets the event to asynchronous mode, allowing the response to be handled by a listener.- Parameters:
responseListener- A consumer that handles the response of the event processing. It can be used to execute actions based on the event's outcome or data.- Returns:
- self for chaining
-
payload
Sets the payload of the event.- Parameters:
payload- The data or object that is associated with this event. This can be any relevant information that needs to be passed along with the event.- Returns:
- self for chaining
-
ifPresent
-
ifPresentAck
-
ifPresent
-
ifPresentAck
-
payload
-
isBroadcast
public boolean isBroadcast() -
broadcast
-
isAcknowledged
public boolean isAcknowledged() -
payloadOpt
-
payload
-
payloadOpt
-
context
-
isAsync
public boolean isAsync() -
async
-
acknowledge
-
acknowledge
-
response
-
response
-
responseOpt
-
response
-
peek
-
putR
-
filter
-
error
-
error
-
send
Sends the event to the Nano instance for processing.- Returns:
- self for chaining
-
toString
- Overrides:
toStringin classAbstractMap<Object,Object>
-
equals
-
hashCode
public int hashCode()
-