org.eclipse.emf.ecore.resource.impl.ResourceImpl.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(141)

本文整理了Java中org.eclipse.emf.ecore.resource.impl.ResourceImpl.<init>方法的一些代码示例,展示了ResourceImpl.<init>的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceImpl.<init>方法的具体详情如下:
包路径:org.eclipse.emf.ecore.resource.impl.ResourceImpl
类名称:ResourceImpl
方法名:<init>

ResourceImpl.<init>介绍

[英]Creates a empty instance.
[中]创建一个空实例。

代码示例

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.ecore

/**
  * Returns a newly allocated default resource {@link org.eclipse.emf.ecore.resource.impl.ResourceImpl#ResourceImpl(URI) implementation}.
  * @param uri the URI.
  * @return a new resource for the URI.
  */
 public Resource createResource(URI uri)
 {
  return new ResourceImpl(uri);
 }
}

代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.ecore

/**
  * Returns a newly allocated default resource {@link org.eclipse.emf.ecore.resource.impl.ResourceImpl#ResourceImpl(URI) implementation}.
  * @param uri the URI.
  * @return a new resource for the URI.
  */
 public Resource createResource(URI uri)
 {
  return new ResourceImpl(uri);
 }
}

代码示例来源:origin: org.eclipse/ocl

/**
 * Creates the resource that persists my generated types.  Subclasses requiring
 * persistence must override this default implementation, as it creates a
 * resource that does not support persistence and does not have a useful URI.
 * A subclass could even find some other resource, such as the model on
 * which constraints are being parsed, if desired.
 * 
 * @return the new resource
 */
protected Resource createResource() {
  return new ResourceImpl(URI.createURI("ocl:///oclenv")); //$NON-NLS-1$
}

代码示例来源:origin: org.openehealth.ipf.eclipse.ocl/ipf-eclipse-ocl

/**
 * Creates the resource that persists my generated types.  Subclasses requiring
 * persistence must override this default implementation, as it creates a
 * resource that does not support persistence and does not have a useful URI.
 * A subclass could even find some other resource, such as the model on
 * which constraints are being parsed, if desired.
 * 
 * @return the new resource
 */
protected Resource createResource() {
  return new ResourceImpl(URI.createURI("ocl:///oclenv")); //$NON-NLS-1$
}

代码示例来源:origin: stackoverflow.com

//Generate your URI
 ResourceFactoryImpl factory = new ResourceFactoryImpl();
 URI sourceURI = URI.createURI("your xml path");
 Resource loadResource = (ResourceImpl)factory.createResource(sourceURI);
 System.out.println(sourceURI.path());
 //Add loading options
 Map<String, Boolean> options = new HashMap<String, Boolean>(); 
 options.put(XMLResource.OPTION_SUPPRESS_DOCUMENT_ROOT, true);
 //Load XML
 loadResource.load( options);
 //Create XMI output
 URI targetURI = URI.createURI("your xmi path");
 Resource resourceOut = new ResourceImpl(targetURI);
 //Generating your EObjects from XML model
 EList listObj = loadResource.getContents();
 EObject obj = (EObject) listObj.get(0);
 resourceOut.getContents().add(obj);
 resourceOut.save(options);

代码示例来源:origin: org.eclipse.uml2/org.eclipse.uml2.uml

@Override
public void endDocument() {
  super.endDocument();
  if (extendedMetaData != null) {
    for (EPackage demandedPackage : extendedMetaData.demandedPackages()) {
      String nsURI = demandedPackage.getNsURI();
      if (nsURI != null) {
        if (urisToLocations != null) {
          URI locationURI = urisToLocations.get(nsURI);
          if (locationURI != null) {
            Resource resource = new ResourceImpl();
            resource.setURI(locationURI);
            resource.getContents().add(demandedPackage);
          }
        }
        for (Map.Entry<String, String> entry : helper
          .getPrefixToNamespaceMap()) {
          if (nsURI.equals(entry.getValue())) {
            demandedPackage.setNsPrefix(entry.getKey());
          }
        }
      }
    }
  }
}

代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.codegen.ecore

if (uri != null)
 Resource genModelResource = new ResourceImpl(uri.trimFileExtension().appendFileExtension("genmodel"));
 genModelResource.getContents().add(genModel);

相关文章

微信公众号

最新文章

更多