Skip to content

Package: ECPDisposable

ECPDisposable

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2013 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Eike Stepper - initial API and implementation
13: * Eugen Neufeld - JavaDoc
14: *
15: *******************************************************************************/
16: package org.eclipse.emf.ecp.spi.core.util;
17:
18: /**
19: * This interface is used on classes that can be disposed.
20: *
21: * @author Eike Stepper
22: * @author Eugen Neufeld
23: * @noextend This interface is not intended to be extended by clients.
24: * @noimplement This interface is not intended to be implemented by clients.
25: * @since 1.1
26: */
27: public interface ECPDisposable {
28:         /**
29:          * Whether this instance is already disposed.
30:          *
31:          * @return true if already disposed, false otherwise.
32:          */
33:         boolean isDisposed();
34:
35:         /**
36:          * Disposes the current instance.
37:          */
38:         void dispose();
39:
40:         /**
41:          * Adds a {@link DisposeListener} to this instance.
42:          *
43:          * @param listener the listener to add
44:          */
45:         void addDisposeListener(DisposeListener listener);
46:
47:         /**
48:          * Removed a {@link DisposeListener} from this instance.
49:          *
50:          * @param listener the listener to remove
51:          */
52:         void removeDisposeListener(DisposeListener listener);
53:
54:         /**
55:          * This interface defines a listener that gets notified when an object is disposed.
56:          *
57:          * @author Eike Stepper
58:          */
59:         public interface DisposeListener {
60:                 /**
61:                  * Callback method being used to notify listeners about a dispose.
62:                  *
63:                  * @param disposable the object being disposed
64:                  * @throws DisposeException is thrown when something goes wrong
65:                  */
66:                 void disposed(ECPDisposable disposable) throws DisposeException;
67:         }
68: }