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

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

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

URI.hasTrailingPathSeparator介绍

[英]Returns true if this is a hierarchical URI that has a path that ends with a trailing separator; false otherwise.

A trailing separator is represented as an empty segment as the last segment in the path; note that this definition does not include the lone separator in the root absolute path.
[中]如果这是一个层次URI,其路径以尾随分隔符结尾,则返回truefalse否则。
尾随分隔符表示为空段,作为路径中的最后一段;请注意,此定义包括根绝对路径中的孤立分隔符。

代码示例

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

@Override
public boolean hasTrailingPathSeparator() {
  return base.hasTrailingPathSeparator();
}

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

@Override
public boolean hasTrailingPathSeparator()
{
 return uri.hasTrailingPathSeparator();
}

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

@Override
public boolean hasTrailingPathSeparator() {
  return internalUri.hasTrailingPathSeparator();
}

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

public static URI toFolderURI(URI uri) {
    if (uri.hasTrailingPathSeparator()) {
      return uri;
    } else {
      return uri.appendSegment("");
    }
  }
}

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

private static void mapUMLResourceURIs(Map<URI, URI> uriMap, String uri,
      URI location) {

    URI prefix = URI.createURI(uri);

    // ensure trailing separator (make it a "URI prefix")
    if (!prefix.hasTrailingPathSeparator()) {
      prefix = prefix.appendSegment(""); //$NON-NLS-1$
    }

    // same with the location
    if (!location.hasTrailingPathSeparator()) {
      location = location.appendSegment(""); //$NON-NLS-1$
    }

    uriMap.put(prefix, location);

    // and platform URIs, too
    String folder = location.segment(location.segmentCount() - 2);
    String platformURI = String.format("%s/%s/", //$NON-NLS-1$
      ResourcesPlugin.PLUGIN_ID, folder);
    uriMap.put(URI.createPlatformPluginURI(platformURI, true), location);
    uriMap.put(URI.createPlatformResourceURI(platformURI, true), location);
  }
}

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

@Override
protected void doPut(final HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
  URI uri = URI.createURI(req.getPathInfo());
  String[] segmentArray = uri.segments();
  if (segmentArray.length == 1)
    putProject(req, uri, resp);
  else if (segmentArray.length == 2)
    putVersion(req, uri, resp);
  else if (segmentArray.length == 3 && uri.hasTrailingPathSeparator())
    putLocale(req, uri, resp);
  else
    putPropertyFile(req, uri, resp);
}

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

/**
 * A URI is a prefix of another URI if:
 * <br/>
 * <ul>
 *     <li>Both have the same scheme</li>
 *     <li>The prefix ends with a trailing separator</li>
 *     <li>The segments of both URIs match up to the prefix's length</li>
 * </ul>
 */
public static boolean isPrefixOf(URI prefix, URI uri) {
  if (prefix.scheme() == null || !prefix.scheme().equals(uri.scheme()))
    return false;
  String[] prefixSeg = prefix.segments();
  String[] uriSeg = uri.segments();
  if (prefixSeg.length == 0 || uriSeg.length == 0)
    return false;
  if (!prefix.hasTrailingPathSeparator())
    return false;
  if (uriSeg.length < prefixSeg.length - 1)
    return false;
  for (int i = 0; i < prefixSeg.length - 1; i++)
    if (!uriSeg[i].equals(prefixSeg[i]))
      return false;
  return true;
}

相关文章

微信公众号

最新文章

更多