Skip to content

Package: EMFFormsViewServiceFactory

EMFFormsViewServiceFactory

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2015 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: * Eugen Neufeld - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emfforms.spi.core.services.view;
15:
16: /**
17: * An {@link EMFFormsViewServiceFactory} defines where and how the service will be available. It also creates the
18: * concrete service instance on demand.
19: *
20: * @param <T> The type of the provided service
21: *
22: * @author Eugen Neufeld
23: * @since 1.8
24: */
25: public interface EMFFormsViewServiceFactory<T> {
26:
27:         /**
28:          * Defines when the service should be activated.
29:          *
30:          * @return The {@link EMFFormsViewServicePolicy} describing when the service should be activated
31:          */
32:         EMFFormsViewServicePolicy getPolicy();
33:
34:         /**
35:          * Defines where the service should be activated.
36:          *
37:          * @return The {@link EMFFormsViewServiceScope} describing where the service should be activated
38:          */
39:         EMFFormsViewServiceScope getScope();
40:
41:         /**
42:          * The priority of the service. The usage of this service is twofold:
43:          * <ol>
44:          * <li>A service with a higher priority is more likely to be used if more than one service
45:          * of the same type is registered.</li>
46:          * <li>A service with lower priority is instantiated and thereby executed earlier than other services of all
47:          * types with higher priorities</li>
48:          * </ol>
49:          *
50:          * @return The priority of this service
51:          */
52:         double getPriority();
53:
54:         /**
55:          * The type of the actual service provided by this provider.
56:          *
57:          * @return The Class of the actual service
58:          */
59:         Class<T> getType();
60:
61:         /**
62:          * Creates a new instance of the provided service.
63:          *
64:          * @param emfFormsViewContext The {@link EMFFormsViewContext} to use during the creation of the service
65:          * @return A new instance of the provided service or null if the service should not be created
66:          */
67:         T createService(EMFFormsViewContext emfFormsViewContext);
68:
69: }