Package com.hazelcast.auditlog
Interface EventBuilder<T extends EventBuilder<T>>
-
- Type Parameters:
T
- builder type
public interface EventBuilder<T extends EventBuilder<T>>
Builder interface forAuditableEvent
instances. The mandatory typeId is expected to be initiated by constructing the builder.Warning: The
text message
andobject parameters
may provide more details about the event, but Hazelcast doesn't guarantee their content (e.g. exact text value of the message, parameter names, object types used in parameters). They can change between versions.- See Also:
AuditlogService.eventBuilder(String)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
addParameter(java.lang.String key, java.lang.Object value)
Adds single event parameter to the parameters Map.AuditableEvent
build()
Builds theAuditableEvent
instance.T
cause(java.lang.Throwable throwable)
Sets error/exception which caused the event (if any).T
level(Level level)
Sets the eventLevel
.void
log()
Builds the event and logs it to the service which provided this builder (if any).T
message(java.lang.String message)
T
parameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
T
timestamp(long timestamp)
If provided value greater than zero, then it sets the event timestamp explicitly.
-
-
-
Method Detail
-
message
T message(java.lang.String message)
- Parameters:
message
- event message. May benull
- Returns:
- this instance
-
parameters
T parameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
- Parameters:
parameters
- event parameters. Must not benull
- Returns:
- this instance
-
addParameter
T addParameter(java.lang.String key, java.lang.Object value)
Adds single event parameter to the parameters Map.- Parameters:
key
- Must not benull
value
-- Returns:
- this instance
-
level
T level(Level level)
Sets the eventLevel
. The default value isLevel.INFO
.- Parameters:
level
-- Returns:
- this instance
-
cause
T cause(java.lang.Throwable throwable)
Sets error/exception which caused the event (if any).- Parameters:
throwable
-- Returns:
- this instance
-
timestamp
T timestamp(long timestamp)
If provided value greater than zero, then it sets the event timestamp explicitly. Otherwise the timestamp is filled by callingbuild()
method.- Parameters:
throwable
-- Returns:
- this instance
-
build
AuditableEvent build()
Builds theAuditableEvent
instance. If the timestamp is not configured explicitly, then the call sets event timestamp too.- Returns:
- not-
null
event instance ready to be logged
-
log
void log()
Builds the event and logs it to the service which provided this builder (if any).- See Also:
AuditlogService.eventBuilder(String)
-
-