public abstract class BaseEvent extends Object implements Event
| Modifier and Type | Field and Description |
|---|---|
protected EventClonePolicy |
clonePolicy
Event clone policy.
|
static int |
DEFAULT_PRIORITY
Default event priority.
|
protected String |
description
Event description.
|
protected String |
id
Event ID.
|
protected String |
label
Event label.
|
protected String |
name
Event name.
|
protected Instant |
time
Event creation time.
|
| Modifier | Constructor and Description |
|---|---|
protected |
BaseEvent(String name,
EventClonePolicy clonePolicy)
Creates a new event that has no ID and time set (both are 0).
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFeature(String name,
Object value) |
void |
addFeatures(Map<String,Object> features) |
BaseEvent |
clone() |
protected abstract <T> T |
doGet(String name,
boolean useDefault,
T defaultValue) |
boolean |
equalsByAttributes(Event event)
Compares events by attributes.
|
boolean |
equalsById(Event event)
Compares events by ID.
|
<T> T |
get(Class<T> cls,
String name) |
<T> T |
get(String name)
Returns the attribute value or throws
IllegalArgumentException if it does't exist. |
<T> T |
get(String name,
T defaultValue) |
protected <T> T |
getDefaultAttributeValue(String name,
boolean useDefault,
T defaultValue) |
String |
getDescription() |
Map<String,Object> |
getFeatures() |
String |
getId()
Returns event ID.
|
String |
getLabel() |
String |
getName()
Returns event name.
|
int |
getPriority()
Returns event priority.
|
Instant |
getTime()
Returns event time.
|
Event |
set(Map<String,Object> attributes) |
void |
setDescription(String description) |
void |
setFeatures(Map<String,Object> features) |
void |
setId(String id)
Sets event ID.
|
void |
setLabel(String label) |
void |
setName(String name) |
void |
setTime(Instant time)
Sets event time.
|
String |
toString() |
protected String |
toStringBase() |
protected void |
validateAttribute(String name,
Object value) |
protected void |
validateFeature(String name,
Object value) |
public static final int DEFAULT_PRIORITY
0.protected String id
protected Instant time
protected String name
protected EventClonePolicy clonePolicy
protected String label
protected String description
protected BaseEvent(String name, EventClonePolicy clonePolicy)
name - an event name.clonePolicy - an event clone policy.public String getName()
getName in interface EventgetName in interface Descriptivepublic void setName(String name)
setName in interface Descriptivepublic Instant getTime()
public void setTime(Instant time)
public String getId()
public void setId(String id)
public int getPriority()
0 for standard events and cannot be changed.getPriority in interface HasPriority<Event>public String getLabel()
getLabel in interface Descriptivepublic void setLabel(String label)
setLabel in interface Descriptivepublic String getDescription()
getDescription in interface Descriptivepublic void setDescription(String description)
setDescription in interface Descriptiveprotected abstract <T> T doGet(String name, boolean useDefault, T defaultValue)
protected final <T> T getDefaultAttributeValue(String name, boolean useDefault, T defaultValue)
public final <T> T get(String name)
IllegalArgumentException if it does't exist.public boolean equalsById(Event event)
equalsById in interface Eventevent - compared event.true if both events are equal by ID.public boolean equalsByAttributes(Event event)
equalsByAttributes in interface Eventevent - compared event.true if both events are equal by attributes.public Map<String,Object> getFeatures()
getFeatures in interface HasFeaturespublic void setFeatures(Map<String,Object> features)
setFeatures in interface HasFeaturespublic void addFeature(String name, Object value)
addFeature in interface Eventpublic void addFeatures(Map<String,Object> features)
addFeatures in interface Eventpublic BaseEvent clone()
protected final String toStringBase()
Copyright © 2016–2020 Softelnet. All rights reserved.