本文整理匯總了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);
}
示例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;
}