当前位置: 首页>>代码示例>>Java>>正文


Java EPackage.getNsURI方法代码示例

本文整理汇总了Java中org.eclipse.emf.ecore.EPackage.getNsURI方法的典型用法代码示例。如果您正苦于以下问题:Java EPackage.getNsURI方法的具体用法?Java EPackage.getNsURI怎么用?Java EPackage.getNsURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.emf.ecore.EPackage的用法示例。


在下文中一共展示了EPackage.getNsURI方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visitPackage

import org.eclipse.emf.ecore.EPackage; //导入方法依赖的package包/类
private void visitPackage(EPackage ePackage) {
    //required for namespace lookups when importing instance model
    String nsURI = ePackage.getNsURI();
    if (nsURI == null) {
        nsURI = ePackage.getName();
        ePackage.setNsURI(nsURI);
    }

    // register all packages we find in the ResourceSet
    this.rs.getPackageRegistry()
        .put(ePackage.getNsURI(), ePackage);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:13,代码来源:EcoreToType.java

示例2: resolveExtension

import org.eclipse.emf.ecore.EPackage; //导入方法依赖的package包/类
public static Extension resolveExtension(final EPackage ePackage) {
	Boolean put = true;
	Extension extension = null;

	String metamodelURI = ePackage.getNsURI();
	extension = namespace2extension.get(metamodelURI);
	// If extension not found then
	// System.out.println("beforeExtension "+namespace2extension);
	// System.out.println("beforeExtension "+extension);
	if (extension == null) {
		// Search URI of the extension into the OCCI extension registry.
		String scheme = Occi2Ecore.convertEcoreNamespace2OcciScheme(metamodelURI);
		String extensionURI = OcciRegistry.getInstance().getExtensionURI(scheme);
		// If extension URI not found then
		if (extensionURI == null) {
			// This is no way to resolve the kind of the given entity :-(
			// TODO: perhaps compute extensionURI of the ePackage of the entity's eClass.
			put = false;
			// Use OCCI Core resource, link or entity kind instances.
			extensionURI = OcciRegistry.getInstance().getExtensionURI(OcciCoreConstants.OCCI_CORE_SCHEME);
		}
		// Here extensionURI is set.
		assert (extensionURI != null);
		// Compute the resource set where loading the extension.
		ResourceSet resourceSet = new ResourceSetImpl();
		// Load the extension.
		Resource extensionResource = resourceSet.getResource(URI.createURI(extensionURI), true);
		extension = (Extension) extensionResource.getContents().get(0);
		// Map the metamodelURI to the found extension for optimizing next searches.
		if (put)
			namespace2extension.put(metamodelURI, extension);
	}
	// Return the found entity's kind.
	// System.out.println("afterExtension "+namespace2extension);
	// System.out.println("afterExtension "+extension);
	return extension;
}
 
开发者ID:occiware,项目名称:OCCI-Studio,代码行数:38,代码来源:GenUtils.java


注:本文中的org.eclipse.emf.ecore.EPackage.getNsURI方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。