|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectit.amattioli.workstate.core.MetaEvent
public class MetaEvent
A MetaEvent is the configuration of an Event that can be sent
to a Machine.
Each MetaEvent has a tag that identifies it and a set of
MetaAttribute that are its parameters.
| Field Summary | |
|---|---|
static MetaEvent |
NULL
|
| Constructor Summary | |
|---|---|
MetaEvent(String tag)
Build a new MetaEvent given its tag. |
|
| Method Summary | |
|---|---|
void |
addParameter(MetaAttribute param)
Add a new parameter to this MetaEvent. |
void |
addValidator(EventValidator validator)
|
void |
checkValidEvent(Event event)
|
void |
checkValidParameter(String tag,
Object value)
|
boolean |
equals(Object obj)
Two MetaEvents are considered equals if they have the same tag. |
MetaAttribute |
getParameter(String tag)
Returns the given parameter definition. |
String |
getTag()
Returns this MetaEvent tag |
Map<String,Object> |
initParameters(Map<String,Object> params)
Returns the actual parameters of an event given a map of the parameters passed by the user. |
boolean |
isAllowedParameter(String tag)
Check if a parameter exists. |
Event |
newEvent(Map<String,Object> parameters)
Build a new Event using this MetaEvent as its definition. |
String |
toString()
Return a string representation of this MetaEvent. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final MetaEvent NULL
| Constructor Detail |
|---|
public MetaEvent(String tag)
MetaEvent given its tag.
tag - the MetaEvent tag
NullPointerException - if the tag is null
IllegalArgumentException - if the tag is an empty sting| Method Detail |
|---|
public String getTag()
public void addParameter(MetaAttribute param)
the - parameter to be added
IllegalArgumentException - if a parameter with the same tag already existspublic MetaAttribute getParameter(String tag)
tag - the desired parameter tag
public void addValidator(EventValidator validator)
public void checkValidParameter(String tag,
Object value)
throws WorkflowException
WorkflowException
public void checkValidEvent(Event event)
throws WorkflowException
WorkflowException
public Map<String,Object> initParameters(Map<String,Object> params)
throws WorkflowException
For parameters that have been defined but for which there is no parameter in the given Map, the initial value will be used.
params - a map containing the parameters passed by the user. The keys
are the parameter tag while the values are the parameter
values. If null is passed it will be considered as an empty
map.
IllegalArgumentException - if the map contains at least a key that is not the tag of a
parameter of this event
ClassCastException - if the class of at least one of the passed parameter is not
compatible with the corresponding parameter definition
WorkflowException
public Event newEvent(Map<String,Object> parameters)
throws WorkflowException
Event using this MetaEvent as its definition.
params - a map containing the parameters passed by the user. The keys
are the parameter tag while the values are the parameter
values. If null is passed it will be considered as an empty
map.
IllegalArgumentException - if the map contains at least a key that is not the tag of a
parameter of this event
ClassCastException - if the class of at least one of the passed parameter is not
compatible with the corresponding parameter definition
WorkflowExceptionpublic boolean isAllowedParameter(String tag)
tag - the parameter tag
public String toString()
toString in class Objectpublic boolean equals(Object obj)
equals in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||