Package org.apache.wiki.event
Class WikiEvent
java.lang.Object
java.util.EventObject
org.apache.wiki.event.WikiEvent
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
WikiEngineEvent,WikiPageEvent,WikiSecurityEvent,WorkflowEvent
public abstract class WikiEvent extends java.util.EventObject
Abstract parent class for wiki events.
- Since:
- 2.3.79
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description static intERRORIndicates a exception or error state.static intUNDEFINEDIndicates an undefined state.Fields inherited from class java.util.EventObject
source -
Constructor Summary
-
Method Summary
Modifier and Type Method Description java.lang.StringeventName()Returns a textual representation of an event type.<T> TgetArg(int index, java.lang.Class<T> cls)Returns the requested arg, if any.java.lang.Object[]getArgs()Returns the args associated to src, if any.<T> TgetSrc()Convenience method that returns the typed object to which the event applied.intgetType()Returns the type of this event.java.lang.StringgetTypeDescription()Returns a String (human-readable) description of an event type.longgetWhen()Returns the timestamp of when this WikiEvent occurred.static booleanisValidType(int type)Returns true if the int value is a valid WikiEvent type.protected voidsetType(int type)Sets the type of this event.java.lang.StringtoString()Prints a String (human-readable) representation of this object.Methods inherited from class java.util.EventObject
getSourceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
ERROR
Indicates a exception or error state.- See Also:
- Constant Field Values
-
UNDEFINED
Indicates an undefined state.- See Also:
- Constant Field Values
-
-
Constructor Details
-
WikiEvent
Constructs an instance of this event.- Parameters:
src- the Object that is the source of the event.type- the event type.
-
WikiEvent
Constructs an instance of this event.- Parameters:
src- the Object that is the source of the event.type- the event type.
-
-
Method Details
-
getSrc
Convenience method that returns the typed object to which the event applied.- Returns:
- the typed object to which the event applied.
-
getWhen
Returns the timestamp of when this WikiEvent occurred.- Returns:
- this event's timestamp
- Since:
- 2.4.74
-
setType
Sets the type of this event. Validation of acceptable type values is the responsibility of each subclass.- Parameters:
type- the type of this WikiEvent.
-
getType
Returns the type of this event.- Returns:
- the type of this WikiEvent. See the enumerated values defined in
WikiEvent).
-
getArgs
Returns the args associated to src, if any.- Returns:
- args associated to src, if any.
-
getArg
Returns the requested arg, if any.- Returns:
- requested arg or null.
-
getTypeDescription
Returns a String (human-readable) description of an event type. This should be subclassed as necessary.- Returns:
- the String description
-
isValidType
Returns true if the int value is a valid WikiEvent type. Because the WikiEvent class does not itself any event types, this method returns true if the event type is anything exceptERRORorUNDEFINED. This method is meant to be subclassed as appropriate.- Parameters:
type- The value to test.- Returns:
- true, if the value is a valid WikiEvent type.
-
eventName
Returns a textual representation of an event type.- Returns:
- the String representation
-
toString
Prints a String (human-readable) representation of this object. This should be subclassed as necessary.- Overrides:
toStringin classjava.util.EventObject- Returns:
- the String representation
- See Also:
Object.toString()
-