org.apache.jackrabbit.util.Text.explode()方法的使用及代码示例

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

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

Text.explode介绍

[英]returns an array of strings decomposed of the original string, split at every occurrence of 'ch'. if 2 'ch' follow each other with no intermediate characters, empty "" entries are avoided.
[中]返回原始字符串分解后的字符串数组,在每次出现“ch”时拆分。如果两个“ch”后面没有中间字符,则避免使用空的“”条目。

代码示例

代码示例来源:origin: com.github.igor-suhorukov/dom-transformation

/**
 * returns an array of strings decomposed of the original string, split at
 * every occurrence of 'ch'. if 2 'ch' follow each other with no intermediate
 * characters, empty "" entries are avoided.
 *
 * @param str the string to decompose
 * @param ch  the character to use a split pattern
 * @return an array of strings
 */
public static String[] explode(String str, int ch) {
  return explode(str, ch, false);
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

/**
 * returns an array of strings decomposed of the original string, split at
 * every occurrence of 'ch'. if 2 'ch' follow each other with no intermediate
 * characters, empty "" entries are avoided.
 *
 * @param str the string to decompose
 * @param ch  the character to use a split pattern
 * @return an array of strings
 */
public static String[] explode(String str, int ch) {
  return explode(str, ch, false);
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-jcr-commons

/**
 * returns an array of strings decomposed of the original string, split at
 * every occurrence of 'ch'. if 2 'ch' follow each other with no intermediate
 * characters, empty "" entries are avoided.
 *
 * @param str the string to decompose
 * @param ch  the character to use a split pattern
 * @return an array of strings
 */
public static String[] explode(String str, int ch) {
  return explode(str, ch, false);
}

代码示例来源:origin: apache/jackrabbit

/**
 * returns an array of strings decomposed of the original string, split at
 * every occurrence of 'ch'. if 2 'ch' follow each other with no intermediate
 * characters, empty "" entries are avoided.
 *
 * @param str the string to decompose
 * @param ch  the character to use a split pattern
 * @return an array of strings
 */
public static String[] explode(String str, int ch) {
  return explode(str, ch, false);
}

代码示例来源:origin: org.apache.jackrabbit/com.springsource.org.apache.jackrabbit.commons

/**
 * returns an array of strings decomposed of the original string, split at
 * every occurance of 'ch'. if 2 'ch' follow each other with no intermediate
 * characters, empty "" entries are avoided.
 *
 * @param str the string to decompose
 * @param ch  the character to use a split pattern
 * @return an array of strings
 */
public static String[] explode(String str, int ch) {
  return explode(str, ch, false);
}

代码示例来源:origin: apache/jackrabbit-oak

public String toMapName(String name, char delim) {
  StringBuffer ret = new StringBuffer();
  String[] elems = Text.explode(name, delim);
  ret.append(elems[0]);
  for (int i=1; i<elems.length; i++) {
    ret.append(elems[i].substring(0, 1).toUpperCase());
    ret.append(elems[i].substring(1));
  }
  return ret.toString();
}

代码示例来源:origin: apache/jackrabbit

public String toMapName(String name, char delim) {
  StringBuffer ret = new StringBuffer();
  String[] elems = Text.explode(name, delim);
  ret.append(elems[0]);
  for (int i=1; i<elems.length; i++) {
    ret.append(elems[i].substring(0, 1).toUpperCase());
    ret.append(elems[i].substring(1));
  }
  return ret.toString();
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-webapp

public String toMapName(String name, char delim) {
  StringBuffer ret = new StringBuffer();
  String[] elems = Text.explode(name, delim);
  ret.append(elems[0]);
  for (int i=1; i<elems.length; i++) {
    ret.append(elems[i].substring(0, 1).toUpperCase());
    ret.append(elems[i].substring(1));
  }
  return ret.toString();
}

代码示例来源:origin: apache/jackrabbit

/**
   * Recursively creates nodes below the specified root node.
   *
   * @param root
   * @param relPath
   * @return the node corresponding to the last segment of the specified
   * relative path.
   * @throws RepositoryException
   */
  public static Node mkDirs(Node root, String relPath, String dirNodeType) throws RepositoryException {
    for (String seg : Text.explode(relPath, '/')) {
      if (!root.hasNode(seg)) {
        root.addNode(seg, dirNodeType);
      }
      root = root.getNode(seg);
    }
    return root;
  }
}

代码示例来源:origin: org.apache.jackrabbit/jackrabbit-core

/**
   *
   * @param configParam
   * @return
   */
  private static String[] split(String configParam) {
    List<String> nameList = new ArrayList<String>();
    for (String pn : Text.explode(configParam, ',', false)) {
      String privName = pn.trim();
      if (privName.length()  > 0) {
        nameList.add(privName);
      }
    }
    return nameList.toArray(new String[nameList.size()]);
  }
}

代码示例来源:origin: apache/jackrabbit

/**
   *
   * @param configParam
   * @return
   */
  private static String[] split(String configParam) {
    List<String> nameList = new ArrayList<String>();
    for (String pn : Text.explode(configParam, ',', false)) {
      String privName = pn.trim();
      if (privName.length()  > 0) {
        nameList.add(privName);
      }
    }
    return nameList.toArray(new String[nameList.size()]);
  }
}

代码示例来源:origin: org.apache.jackrabbit/oak-upgrade

GroupEditor(@NotNull NodeBuilder builder, @NotNull String groupsPath) {
  this.state = new State(builder);
  this.groupsRoot = Text.explode(groupsPath, '/', false);
  // writer.setMembershipSizeThreshold(10); // uncomment to test different split sizes
}

代码示例来源:origin: apache/jackrabbit-oak

GroupEditor(@NotNull NodeBuilder builder, @NotNull String groupsPath) {
  this.state = new State(builder);
  this.groupsRoot = Text.explode(groupsPath, '/', false);
  // writer.setMembershipSizeThreshold(10); // uncomment to test different split sizes
}

代码示例来源:origin: org.apache.jackrabbit/oak-core

@Nullable
private static String getQueryPath(@NotNull String relPath) {
  if (relPath.indexOf('/') == -1) {
    // just a single segment -> don't include the path in the query
    return null;
  } else {
    // compute the relative path excluding the trailing property name
    String[] segments = Text.explode(relPath, '/', false);
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < segments.length - 1; i++) {
      if (!PathUtils.denotesCurrent(segments[i])) {
        if (i > 0) {
          sb.append('/');
        }
        sb.append(segments[i]);
      }
    }
    return Strings.emptyToNull(sb.toString());
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@Nullable
private static String getQueryPath(@NotNull String relPath) {
  if (relPath.indexOf('/') == -1) {
    // just a single segment -> don't include the path in the query
    return null;
  } else {
    // compute the relative path excluding the trailing property name
    String[] segments = Text.explode(relPath, '/', false);
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < segments.length - 1; i++) {
      if (!PathUtils.denotesCurrent(segments[i])) {
        if (i > 0) {
          sb.append('/');
        }
        sb.append(segments[i]);
      }
    }
    return Strings.emptyToNull(sb.toString());
  }
}

代码示例来源:origin: apache/jackrabbit-oak

@SuppressWarnings("UnusedDeclaration")
@Activate
public void activate(Map<String, Object> properties) {
  ConfigurationParameters config = ConfigurationParameters.of(properties);
  for (String entry : config.getConfigValue("externalidentities", Collections.<String>emptySet())) {
    String[] strs = Text.explode(entry, ',', false);
    String uid = strs[0].trim();
    Set<String> declaredGroups = new HashSet<String>();
    if (strs.length > 1) {
      for (int i = 1; i < strs.length; i++) {
        groupIds.add(strs[i]);
        declaredGroups.add(strs[i]);
      }
    }
    userGroupMap.put(uid, declaredGroups);
  }
  log.info("activated IDP: " + getName());
}

代码示例来源:origin: org.onehippo.cms7/hippo-repository-engine

public static String calculateFsBundleDigest(final PartialZipFile bundleZipFile, final WebFilesService webfilesService) throws IOException {
  final Map<String, String> jarBundle = new TreeMap<>();
  final Enumeration<? extends ZipEntry> entries = bundleZipFile.entries();
  while (entries.hasMoreElements()) {
    final ZipEntry zipEntry = entries.nextElement();
    final boolean isDirectory = zipEntry.isDirectory();
    final String path = zipEntry.getName();
    final String[] names = Text.explode(path, '/');
    if (names.length > 0 && isIncluded(names, isDirectory, zipEntry.getSize(), webfilesService)) {
      if (!isDirectory) {
        try (final InputStream inputStream = bundleZipFile.getInputStream(zipEntry)) {
          final String digest = DigestUtils.digestFromStream(inputStream);
          jarBundle.put(zipEntry.getName(), digest);
        }
      }
    }
  }
  final String jarChecksum = jarBundle.keySet().stream().map(jarBundle::get).collect(Collectors.joining());
  return DigestUtils.computeManifestDigest(jarChecksum);
}

代码示例来源:origin: org.apache.jackrabbit/oak-core

@NotNull
private static TreeLocation getLocation(@NotNull Tree tree, @NotNull String relativePath) {
  TreeLocation loc = TreeLocation.create(tree);
  for (String element : Text.explode(relativePath, '/', false)) {
    if (PathUtils.denotesParent(element)) {
      loc = loc.getParent();
    } else if (!PathUtils.denotesCurrent(element)) {
      loc = loc.getChild(element);
    }  // else . -> skip to next element
  }
  return loc;
}

代码示例来源:origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Nonnull
private static TreeLocation getLocation(@Nonnull Tree tree, @Nonnull String relativePath) {
  TreeLocation loc = TreeLocation.create(tree);
  for (String element : Text.explode(relativePath, '/', false)) {
    if (PathUtils.denotesParent(element)) {
      loc = loc.getParent();
    } else if (!PathUtils.denotesCurrent(element)) {
      loc = loc.getChild(element);
    }  // else . -> skip to next element
  }
  return loc;
}

代码示例来源:origin: apache/jackrabbit-oak

@NotNull
private static TreeLocation getLocation(@NotNull Tree tree, @NotNull String relativePath) {
  TreeLocation loc = TreeLocation.create(tree);
  for (String element : Text.explode(relativePath, '/', false)) {
    if (PathUtils.denotesParent(element)) {
      loc = loc.getParent();
    } else if (!PathUtils.denotesCurrent(element)) {
      loc = loc.getChild(element);
    }  // else . -> skip to next element
  }
  return loc;
}

相关文章