@SPI
public final class Events
extends java.lang.Object
Event
objects.Modifier and Type | Method and Description |
---|---|
static io.spine.core.EventId |
checkValid(io.spine.core.EventId id)
Deprecated.
please use
Preconditions2.checkNotDefaultArg(Message) |
static io.spine.base.EventMessage |
ensureMessage(com.google.protobuf.Message eventOrMessage)
Extracts an event message if the passed instance is an
Event object or Any ,
otherwise returns the passed message. |
static io.spine.core.EventId |
generateId()
Creates a new
EventId based on random UUID. |
static io.spine.string.Stringifier<io.spine.core.EventId> |
idStringifier()
Obtains the stringifier for event IDs.
|
static <M extends io.spine.base.EventMessage> |
nothing()
Creates an empty
Iterable over the messages of the type <M> . |
static io.spine.core.Event |
toExternal(io.spine.core.Event event)
Marks the given event as
external . |
static com.google.common.collect.ImmutableList<io.spine.core.Event> |
toExternal(java.util.List<io.spine.core.Event> events)
Marks all the given events as
external . |
public static io.spine.core.EventId generateId()
EventId
based on random UUID.public static io.spine.base.EventMessage ensureMessage(com.google.protobuf.Message eventOrMessage)
Event
object or Any
,
otherwise returns the passed message.public static io.spine.string.Stringifier<io.spine.core.EventId> idStringifier()
@Deprecated public static io.spine.core.EventId checkValid(io.spine.core.EventId id)
Preconditions2.checkNotDefaultArg(Message)
id
- an ID to checkjava.lang.IllegalArgumentException
- if the ID string value is empty or blankpublic static <M extends io.spine.base.EventMessage> java.lang.Iterable<M> nothing()
Iterable
over the messages of the type <M>
.
This method is useful for returning empty result from reacting methods.
M
- the type of messagesIterable
public static com.google.common.collect.ImmutableList<io.spine.core.Event> toExternal(java.util.List<io.spine.core.Event> events)
external
.
The order of the events is preserved in the output list.
public static io.spine.core.Event toExternal(io.spine.core.Event event)
external
.