Skip to content

Package: StringViewModelMigratorUtil

StringViewModelMigratorUtil

nameinstructionbranchcomplexitylinemethod
executeContentHandler(String, DefaultHandler)
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
getNamespaceURIs(String)
M: 0 C: 10
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%

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: * Johannes Faltermeier - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.spi.view.migrator.string;
15:
16: import java.io.StringReader;
17: import java.util.List;
18:
19: import org.eclipse.emf.ecp.spi.view.migrator.NameSpaceHandler;
20: import org.eclipse.emf.ecp.spi.view.migrator.SAXUtil;
21: import org.xml.sax.helpers.DefaultHandler;
22:
23: /**
24: * Util methods related to string view model migration.
25: *
26: * @author Johannes Faltermeier
27: * @since 1.8
28: *
29: */
30: public final class StringViewModelMigratorUtil {
31:
32:         private StringViewModelMigratorUtil() {
33:         }
34:
35:         /**
36:          * Parses the given view model string and return the used namespace uris.
37:          *
38:          * @param serializedViewModel the view model as a string
39:          * @return the uris
40:          */
41:         public static List<String> getNamespaceURIs(String serializedViewModel) {
42:                 final NameSpaceHandler handler = new NameSpaceHandler();
43:                 executeContentHandler(serializedViewModel, handler);
44:                 return handler.getNsURIs();
45:         }
46:
47:         private static void executeContentHandler(String serializedViewModel, final DefaultHandler contentHandler) {
48:                 SAXUtil.executeContentHandler(new StringReader(serializedViewModel), contentHandler);
49:         }
50:
51: }