All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.undefinedlabs.scope.events.custom.CustomEvent Maven / Gradle / Ivy

package com.undefinedlabs.scope.events.custom;

import org.apache.commons.lang3.builder.ToStringBuilder;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class CustomEvent {

  private final Map eventFields;

  CustomEvent(final Builder builder) {
    this.eventFields = Collections.unmodifiableMap(builder.eventFields);
  }

  public Map getFields() {
    return this.eventFields;
  }

  public static Builder newBuilder() {
    return new Builder();
  }

  public static class Builder {

    private Map eventFields = new HashMap<>();

    public Builder putField(final String key, final Object value) {
      this.eventFields.put(key, value);
      return this;
    }

    public CustomEvent build() {
      return new CustomEvent(this);
    }
  }

  @Override
  public String toString() {
    return new ToStringBuilder(this).append("eventFields", eventFields).toString();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy