001package arez.spy;
002
003import java.util.Map;
004import java.util.Objects;
005import javax.annotation.Nonnull;
006
007/**
008 * Notification when Action starts.
009 */
010public final class ActionStartEvent
011  implements SerializableEvent
012{
013  @Nonnull
014  private final String _name;
015  /**
016   * Is the action a "tracking" action.
017   */
018  private final boolean _tracked;
019  @Nonnull
020  private final Object[] _parameters;
021
022  public ActionStartEvent( @Nonnull final String name, final boolean tracked, @Nonnull final Object[] parameters )
023  {
024    _name = Objects.requireNonNull( name );
025    _tracked = tracked;
026    _parameters = Objects.requireNonNull( parameters );
027  }
028
029  @Nonnull
030  public String getName()
031  {
032    return _name;
033  }
034
035  public boolean isTracked()
036  {
037    return _tracked;
038  }
039
040  @Nonnull
041  public Object[] getParameters()
042  {
043    return _parameters;
044  }
045
046  @Override
047  public void toMap( @Nonnull final Map<String, Object> map )
048  {
049    map.put( "type", "ActionStart" );
050    map.put( "name", getName() );
051    map.put( "tracked", isTracked() );
052    map.put( "parameters", getParameters() );
053  }
054}