當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。