Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: e5539396fd72c1b674e042640f266e96ed23388a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Eike Stepper - initial API and implementation
 */
package org.eclipse.net4j.util.event;

import java.text.MessageFormat;
import java.util.EventObject;

/**
 * A default implementation of an {@link IEvent event}.
 * 
 * @author Eike Stepper
 */
public class Event extends EventObject implements IEvent
{
  private static final long serialVersionUID = 1L;

  public Event(INotifier notifier)
  {
    super(notifier);
  }

  @Override
  public INotifier getSource()
  {
    return (INotifier)source;
  }

  @Override
  public String toString()
  {
    String params = formatAdditionalParameters();
    params = params == null ? "" : ", " + params;
    return MessageFormat.format("{0}[source={1}{2}]", getClass().getSimpleName(), getSource(), params);
  }

  /**
   * @since 3.0
   */
  protected String formatAdditionalParameters()
  {
    return null;
  }
}

Back to the top