org.eclipse.emf.common.util.URI.createHierarchicalURI()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(77)

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

URI.createHierarchicalURI介绍

[英]Static factory method for a hierarchical URI with no path. The URI will be relative if scheme is non-null, and absolute otherwise. An absolute URI with no path requires a non-null authority and/or device.
[中]没有路径的分层URI的静态工厂方法。如果scheme为非空,则URI为相对,否则为绝对。没有路径的绝对URI需要非空authority和/或device

代码示例

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

public URI createPackageURI(String packageName) {
  String[] pkgname = null;
  if (packageName != null && packageName.length() > 0)
    pkgname = new String[] {packageName};
  return URI.createHierarchicalURI(JAVA_PROTOCOL_URI_SCHEME, null, null, pkgname, null, JavaPackage.PACKAGE_ID);
}
/* (non-Javadoc)

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

public URI createTypeURI(String packageName, String typeName) {
  String[] pkgname = null;
  if (packageName != null && packageName.length() > 0)
    pkgname = new String[] {packageName};
  return URI.createHierarchicalURI(JAVA_PROTOCOL_URI_SCHEME, null, null, pkgname, null, createTypeName(typeName));
}

代码示例来源:origin: org.jabylon/rest.ui

@SuppressWarnings("unchecked")
protected T doLookup(List<String> segments) {
  List<String> modified = new ArrayList<String>(segments);
  if(segments.isEmpty() || !segments.get(0).equals("workspace"))
    modified.add(0, "workspace");
  
  URI uri = URI.createHierarchicalURI(modified.toArray(new String[modified.size()]), null, null);
  return (T) getLookup().resolve(uri);
}

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

public URI getURIForTrace(URI uri) {
  if (uri.isPlatform()) {
    // create a URI that is relative to the contained projects.
    List<String> segments = uri.segmentsList().subList(2, uri.segmentCount());
    return URI.createHierarchicalURI(segments.toArray(new String[segments.size()]), null, null);
  }
  return uri.trimFragment().trimQuery();
}

代码示例来源:origin: org.jabylon/properties

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated NOT
 */
@SuppressWarnings("rawtypes")
public URI toURI() {
  EObject object = this;
  Deque<String> segments = new ArrayDeque<String>();
  while (object != null)
  {
    if (object instanceof Resolvable<?, ?>) {
      Resolvable r = (Resolvable) object;
      //TODO: this shouldn't be necessary. Make this more consistent
      if(r.getName()!=null)
        segments.push((r).getName());
    }
    object = object.eContainer();
  }
  return URI.createHierarchicalURI(segments.toArray(new String[segments.size()]),null,null);
}

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

protected URI normalizePluginURI(URI uri, String fragment) {
  if (uri.segmentCount() < 2)
    return uri; // Invalid, just let it go on.
  // See if already normalized.
  int u_scoreNdx = uri.segment(1).lastIndexOf('_');
  if (u_scoreNdx != -1) {
    // Not normalized. Remove the version to make it normalized.
    String[] segments = uri.segments();
    segments[1] = segments[1].substring(0, u_scoreNdx);
    return URI.createHierarchicalURI(uri.scheme(), uri.authority(), uri.device(), segments, uri.query(), fragment);
  } else
    return uri;
}

代码示例来源:origin: atlanmod/NeoEMF

@Nonnull
  @Override
  public URI createRemoteUri(InetAddress host, int port, String model) {
    if (!supportsRemoteUris()) {
      throw new UnsupportedOperationException(String.format("%s does not support server-based URIs", getClass().getSimpleName()));
    }

    checkNotNull(host, "host");
    checkGreaterThanOrEqualTo(port, 0, "port (%d) must be between 0-65535", port);
    checkLessThanOrEqualTo(port, 65535, "port (%d) must be between 0-65535", port);
    checkNotNull(model, "model");

    checkArgument(BackendFactoryRegistry.getInstance().isRegistered(scheme()), "Unregistered scheme (%s)", scheme());

    return URI.createHierarchicalURI(scheme(),
        host.getHostAddress() + ':' + port,
        null,
        new String[]{model},
        null,
        null);
  }
}

代码示例来源:origin: atlanmod/NeoEMF

@Nonnull
@Override
public URI createLocalUri(File file) {
  checkNotNull(file, "file");
  final URI fileUri = URI.createFileURI(file.getAbsolutePath());
  final URI uri = URI.createHierarchicalURI(scheme(),
      fileUri.authority(),
      fileUri.device(),
      fileUri.segments(),
      fileUri.query(),
      fileUri.fragment());
  return createLocalUri(uri);
}

代码示例来源:origin: org.jabylon/rest.api

System.arraycopy(segmentArray, projectPart.length, descriptorPart, 0, descriptorPart.length);
URI projectURI = URI.createHierarchicalURI(projectPart, null, null);
Resolvable version = getObject(projectURI.path());
if (version instanceof ProjectVersion) {
    URI descriptorLocation = URI.createHierarchicalURI(descriptorPart, null, null);
    File folder = new File(projectVersion.absoluteFilePath().toFileString());
    File propertyFile = new File(folder, descriptorLocation.path());

代码示例来源:origin: org.jabylon/properties

@Override
public Resolvable resolveChild(URI path) {
  if (path.segmentCount() == 0 || relativePath().equals(path))
    return this;
  String localeSegment = path.segment(0);
  ProjectLocale projectLocale = null;
  if (localeSegment.equals("template"))
    projectLocale = getTemplate();
  else {
    Locale locale = (Locale) PropertiesFactory.eINSTANCE.createFromString(PropertiesPackage.Literals.LOCALE, localeSegment);
    if (locale == null)
      return null;
    projectLocale = getProjectLocale(locale);
  }
  if (path.segmentCount() == 1)
    return projectLocale;
  String[] segments = path.segments();
  String[] remainder = new String[segments.length - 1];
  System.arraycopy(segments, 1, remainder, 0, remainder.length);
  URI shorterURI = URI.createHierarchicalURI(remainder, null, null);
  return projectLocale.resolveChild(shorterURI);
}

代码示例来源:origin: fr.inria.atlanmod.neoemf/neoemf-core

@Override
public String toFileString() {
  URI uri = URI.createHierarchicalURI(
      FILE_SCHEME,
      internalUri.authority(),
      internalUri.device(),
      internalUri.segments(),
      internalUri.query(),
      internalUri.fragment());
  return uri.toFileString();
}

代码示例来源:origin: atlanmod/NeoEMF

@Override
public String toFileString() {
  return URI.createHierarchicalURI(
      SCHEME,
      base.authority(),
      base.device(),
      base.segments(),
      base.query(),
      base.fragment()
  ).toFileString();
}

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

/**
  * converts the file URIs with an absent authority to one with an empty
  */
 public URI withEmptyAuthority(final URI uri) {
  URI _xifexpression = null;
  if ((uri.isFile() && (uri.authority() == null))) {
   _xifexpression = URI.createHierarchicalURI(uri.scheme(), "", uri.device(), uri.segments(), uri.query(), uri.fragment());
  } else {
   _xifexpression = uri;
  }
  return _xifexpression;
 }
}

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

uri = URI.createHierarchicalURI(null, null, resource.getURIFragment(eObject));

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

uri = URI.createHierarchicalURI(null, null, resource.getURIFragment(eObject));

相关文章

微信公众号

最新文章

更多