当前位置: 首页>>代码示例>>Java>>正文


Java StringUtils.deleteWhitespace方法代码示例

本文整理汇总了Java中org.apache.commons.lang.StringUtils.deleteWhitespace方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.deleteWhitespace方法的具体用法?Java StringUtils.deleteWhitespace怎么用?Java StringUtils.deleteWhitespace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang.StringUtils的用法示例。


在下文中一共展示了StringUtils.deleteWhitespace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPlaceholderRequest

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
@Override
public String onPlaceholderRequest(Player p, String identifier) {
    if(identifier.equals("current_tag")){
        String storageTag = StorageHandler.getPlayerTag(p);

        String tag = storageTag != null ? storageTag : "";

        DogTag dt = DogTags.getTag(tag);
        if(dt == null){
            return StringUtils.deleteWhitespace("");
        }else return dt.getPrefix();

    }
    return null;
}
 
开发者ID:Chazmondo,项目名称:DogTags,代码行数:16,代码来源:PlaceholderAPIHook.java

示例2: doWatch

import org.apache.commons.lang.StringUtils; //导入方法依赖的package包/类
public void doWatch(String configCenter)
    throws URISyntaxException, UnsupportedEncodingException, InterruptedException {
  CountDownLatch waiter = new CountDownLatch(1);
  IpPort ipPort = NetUtils.parseIpPortFromURI(configCenter);
  String url = URIConst.REFRESH_ITEMS + "?dimensionsInfo="
      + StringUtils.deleteWhitespace(URLEncoder.encode(serviceName, "UTF-8"));
  Map<String, String> headers = new HashMap<>();
  headers.put("x-domain-name", tenantName);
  if (ConfigCenterConfig.INSTANCE.getToken() != null) {
    headers.put("X-Auth-Token", ConfigCenterConfig.INSTANCE.getToken());
  }

  HttpClientWithContext vertxHttpClient = clientMgr.findThreadBindClientPool();
  vertxHttpClient.runOnContext(client -> {
    Map<String, String> authHeaders = new HashMap<>();
    authHeaderProviders.forEach(provider -> authHeaders.putAll(provider.getSignAuthHeaders(
        createSignRequest(null, configCenter + url, headers, null))));

    client.websocket(refreshPort, ipPort.getHostOrIp(), url,
        new CaseInsensitiveHeaders().addAll(headers)
            .addAll(authHeaders),
        ws -> {
          ws.exceptionHandler(e -> {
            LOGGER.error("watch config read fail", e);
            stopHeartBeatThread();
            isWatching = false;
          });
          ws.closeHandler(v -> {
            LOGGER.warn("watching config connection is closed accidentally");
            stopHeartBeatThread();
            isWatching = false;
          });
          ws.handler(action -> {
            LOGGER.info("watching config recieved {}", action);
            Map<String, Object> mAction = action.toJsonObject().getMap();
            if ("CREATE".equals(mAction.get("action"))) {
              refreshConfig(configCenter);
            } else if ("MEMBER_CHANGE".equals(mAction.get("action"))) {
              refreshMembers(memberdis);
            } else {
              parseConfigUtils.refreshConfigItemsIncremental(mAction);
            }
          });
          startHeartBeatThread(ws);
          isWatching = true;
          waiter.countDown();
        },
        e -> {
          LOGGER.error("watcher connect to config center {} failed: {}", serverUri, e.getMessage());
          waiter.countDown();
        });
  });
  waiter.await();
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:55,代码来源:ConfigCenterClient.java


注:本文中的org.apache.commons.lang.StringUtils.deleteWhitespace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。