Interface EventBuilder<T extends EventBuilder<T>>

  • Type Parameters:
    T - builder type

    public interface EventBuilder<T extends EventBuilder<T>>
    Builder interface for AuditableEvent instances. The mandatory typeId is expected to be initiated by constructing the builder.

    Warning: The text message and object 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 the AuditableEvent instance.
      T cause​(java.lang.Throwable throwable)
      Sets error/exception which caused the event (if any).
      T level​(Level level)
      Sets the event Level.
      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 be null
        Returns:
        this instance
      • parameters

        T parameters​(java.util.Map<java.lang.String,​java.lang.Object> parameters)
        Parameters:
        parameters - event parameters. Must not be null
        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 be null
        value -
        Returns:
        this instance
      • level

        T level​(Level level)
        Sets the event Level. The default value is Level.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 calling build() method.
        Parameters:
        throwable -
        Returns:
        this instance
      • build

        AuditableEvent build()
        Builds the AuditableEvent instance. If the timestamp is not configured explicitly, then the call sets event timestamp too.
        Returns:
        not-null event instance ready to be logged