Skip to content

Package: CustomMigrationClassLoader

CustomMigrationClassLoader

nameinstructionbranchcomplexitylinemethod
CustomMigrationClassLoader()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
load(String)
M: 10 C: 15
60%
M: 2 C: 2
50%
M: 2 C: 1
33%
M: 2 C: 5
71%
M: 0 C: 1
100%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2014 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: * jfaltermeier - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.view.edapt;
15:
16: import org.eclipse.core.runtime.Platform;
17: import org.eclipse.emf.edapt.internal.migration.execution.IClassLoader;
18: import org.osgi.framework.Bundle;
19:
20: /**
21: * @author jfaltermeier
22: *
23: */
24: public class CustomMigrationClassLoader implements IClassLoader {
25:
26:         @SuppressWarnings("unchecked")
27:         @Override
28:         public <T> Class<T> load(String name) throws ClassNotFoundException {
29:                 final String bundleNameForClass = CustomMigrationHelper.getInstance().getBundleNameForClass(name);
30:•                if (bundleNameForClass == null) {
31:                         throw new ClassNotFoundException(name);
32:                 }
33:                 final Bundle bundle = Platform.getBundle(bundleNameForClass);
34:•                if (bundle == null) {
35:                         throw new ClassNotFoundException(name);
36:                 }
37:                 return (Class<T>) bundle.loadClass(name);
38:         }
39:
40: }