當前位置: 首頁>>代碼示例>>Java>>正文


Java StringUtil.isBlank方法代碼示例

本文整理匯總了Java中org.jsoup.helper.StringUtil.isBlank方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtil.isBlank方法的具體用法?Java StringUtil.isBlank怎麽用?Java StringUtil.isBlank使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jsoup.helper.StringUtil的用法示例。


在下文中一共展示了StringUtil.isBlank方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fetchCsrfTokenFromHac

import org.jsoup.helper.StringUtil; //導入方法依賴的package包/類
/**
 * Send HTTP GET request to {@link #endpointUrl}, updates {@link #csrfToken}
 * token
 *
 * @return true if {@link #endpointUrl} is accessible
 * @throws IOException
 * @throws ClientProtocolException
 * @throws AuthenticationException 
 */
protected void fetchCsrfTokenFromHac() throws ClientProtocolException, IOException, AuthenticationException {
	final HttpGet getRequest = new HttpGet(getEndpointUrl());

	try {
		final HttpResponse response = httpClient.execute(getRequest, getContext());
		final String responseString = new BasicResponseHandler().handleResponse(response);
		csrfToken = getCsrfToken(responseString);
		
		if( StringUtil.isBlank(csrfToken) ) {
			throw new AuthenticationException(ErrorMessage.CSRF_TOKEN_CANNOT_BE_OBTAINED);
		}
	} catch (UnknownHostException error) {
		final String errorMessage = error.getMessage();
		final Matcher matcher = HACPreferenceConstants.HOST_REGEXP_PATTERN.matcher(getEndpointUrl());

		if (matcher.find() && matcher.group(1).equals(errorMessage)) {
			throw new UnknownHostException(
					String.format(ErrorMessage.UNKNOWN_HOST_EXCEPTION_MESSAGE_FORMAT, matcher.group(1)));
		}
		throw error;
	}
}
 
開發者ID:SAP,項目名稱:hybris-commerce-eclipse-plugin,代碼行數:32,代碼來源:AbstractHACCommunicationManager.java

示例2: displayScriptExecutionResult

import org.jsoup.helper.StringUtil; //導入方法依賴的package包/類
/**
 * Prints script execution result to the console
 * 
 * @param jsonResult
 *            result of script import in JSON format.
 */
protected void displayScriptExecutionResult(final String jsonResult) {
	final JSONObject result = new JSONObject(jsonResult);
	final String output = result.getString(ScriptExecution.Response.OUPUT_KEY);
	final String stacktrace = result.getString(ScriptExecution.Response.STACK_TRACE_KEY);
	final String executionResult = result.getString(ScriptExecution.Response.RESULT_KEY);

	if (StringUtil.isBlank(stacktrace)) {
		ConsoleUtils.printMessage(RESULT_LABEL);
		ConsoleUtils.printMessage(executionResult);
		ConsoleUtils.printLine();
		ConsoleUtils.printMessage(OUTPUT_LABEL);
		ConsoleUtils.printMessage(output);
	} else {
		ConsoleUtils.printError(stacktrace);
		ConsoleUtils.printMessage(output);
	}
}
 
開發者ID:SAP,項目名稱:hybris-commerce-eclipse-plugin,代碼行數:24,代碼來源:ScriptExecutorManager.java

示例3: showDefinition

import org.jsoup.helper.StringUtil; //導入方法依賴的package包/類
protected void showDefinition(ReviewData paramReviewData)
{
  VocabularyData localVocabularyData = paramReviewData.getVocabulary();
  int i = AppletUtil.getAppletStatus(mActivity, "collins");
  if ((i == 2) || (i == 1))
  {
    if (!StringUtil.isBlank(localVocabularyData.getEnDefn()))
    {
      String str1 = localVocabularyData.getEnDefn();
      Matcher localMatcher = Pattern.compile("<vocab>(.*?)</vocab>").matcher(str1);
      String str2 = getBlank(this.mTvWordDefiniton, localVocabularyData.getContent());
      while (localMatcher.find())
        str1 = str1.replaceFirst(localMatcher.group(0), str2);
      mTvWordDefiniton.setText(str1.trim());
      return;
    }
    mTvWordDefiniton.setText(localVocabularyData.getCnDefinition().trim());
    return;
  }
  mTvWordDefiniton.setText(localVocabularyData.getCnDefinition().trim());
}
 
開發者ID:AndyGu,項目名稱:ShanBay,代碼行數:22,代碼來源:SpellView.java

示例4: showDefinition

import org.jsoup.helper.StringUtil; //導入方法依賴的package包/類
protected void showDefinition(ReviewData paramReviewData)
{
  VocabularyData localVocabularyData = paramReviewData.getVocabulary();
  if (this.mIsEnableCollins)
  {
    if (!StringUtil.isBlank(localVocabularyData.getEnDefn()))
    {
      String str1 = localVocabularyData.getEnDefn();
      Matcher localMatcher = Pattern.compile("<vocab>(.*?)</vocab>").matcher(str1);
      String str2 = getBlank(this.mTvWordDefiniton, localVocabularyData.getContent());
      while (localMatcher.find())
        str1 = str1.replaceFirst(localMatcher.group(0), str2);
      this.mTvWordDefiniton.setText(str1.trim());
      return;
    }
    this.mTvWordDefiniton.setText(StringUtils.trimToEmpty(localVocabularyData.getCnDefinition()));
    return;
  }
  this.mTvWordDefiniton.setText(StringUtils.trimToEmpty(localVocabularyData.getCnDefinition()));
}
 
開發者ID:AndyGu,項目名稱:ShanBay,代碼行數:21,代碼來源:ExpSpellView.java

示例5: performSearchById

import org.jsoup.helper.StringUtil; //導入方法依賴的package包/類
@Override
public Optional<BibEntry> performSearchById(String identifier) throws FetcherException {
    if (StringUtil.isBlank(identifier)) {
        return Optional.empty();
    }

    this.ensureThatIsbnIsValid(identifier);

    IsbnViaEbookDeFetcher isbnViaEbookDeFetcher = new IsbnViaEbookDeFetcher(importFormatPreferences);
    Optional<BibEntry> bibEntry = isbnViaEbookDeFetcher.performSearchById(identifier);
    // nothing found at ebook.de, try chimbori.com
    if (!bibEntry.isPresent()) {
        LOGGER.debug("No entry found at ebook.de try chimbori.com");
        IsbnViaChimboriFetcher isbnViaChimboriFetcher = new IsbnViaChimboriFetcher(importFormatPreferences);
        bibEntry = isbnViaChimboriFetcher.performSearchById(identifier);

    }

    return bibEntry;
}
 
開發者ID:JabRef,項目名稱:jabref,代碼行數:21,代碼來源:IsbnFetcher.java

示例6: selectList

import org.jsoup.helper.StringUtil; //導入方法依賴的package包/類
@Override
public List<String> selectList(Element element) {
    Elements elements = element.select("a");
    List<String> links = new ArrayList<String>(elements.size());
    for (Element element0 : elements) {
        if (!StringUtil.isBlank(element0.baseUri())) {
            links.add(element0.attr("abs:href"));
        } else {
            links.add(element0.attr("href"));
        }
    }
    return links;
}
 
開發者ID:fengzhizi715,項目名稱:NetDiscovery,代碼行數:14,代碼來源:LinksSelector.java

示例7: isEmptyElement

import org.jsoup.helper.StringUtil; //導入方法依賴的package包/類
public static boolean isEmptyElement(Node node) {
    if (node == null) {
        return false;
    }
    if (node instanceof TextNode) {
        return StringUtil.isBlank(((TextNode) node).text());
    }
    if (!(node instanceof Element)) {
        return false;
    }
    boolean isEmptyTag = ((Element) node).tag().isEmpty();
    return !isEmptyTag && hasEmptyChidren(node);
}
 
開發者ID:UKPLab,項目名稱:sigir2016-collection-for-focused-retrieval,代碼行數:14,代碼來源:NodeHelper.java

示例8: hasEmptyChidren

import org.jsoup.helper.StringUtil; //導入方法依賴的package包/類
public static boolean hasEmptyChidren(Node node) {
    if (node.childNodeSize() == 0) {
        return true;
    }
    for (Node n : node.childNodes()) {
        if (!(n instanceof TextNode)) {
            return false;
        }

        if (!StringUtil.isBlank(((TextNode) n).text())) {
            return false;
        }
    }
    return true;
}
 
開發者ID:UKPLab,項目名稱:sigir2016-collection-for-focused-retrieval,代碼行數:16,代碼來源:NodeHelper.java

示例9: head

import org.jsoup.helper.StringUtil; //導入方法依賴的package包/類
@Override
public void head(Node node, int depth)
{
    if (node.childNodeSize() == 0) {
        if (node instanceof TextNode && StringUtil.isBlank(node.outerHtml())) {
            return;
        }
        mergeToResult(node);
        nodes.add(node);
    }
}
 
開發者ID:UKPLab,項目名稱:sigir2016-collection-for-focused-retrieval,代碼行數:12,代碼來源:ParagraphsExplorer.java

示例10: getCsrfToken

import org.jsoup.helper.StringUtil; //導入方法依賴的package包/類
/**
 * Retrieves csrf token from response body
 *
 * @param responseBody
 *            response body of GET method
 * @return csrf token
 * @throws AuthenticationException 
 */
protected String getCsrfToken(String responseBody) throws AuthenticationException {
	if( StringUtil.isBlank(responseBody) ) {
		throw new AuthenticationException(ErrorMessage.CSRF_RESPONSE_CANNOT_BE_BLANK);
	}
	
	final Document document = Jsoup.parse(responseBody);
	return document.select(Meta.CSRF_META_TAG).attr(Meta.CSRF_META_TAG_CONTENT);
}
 
開發者ID:SAP,項目名稱:hybris-commerce-eclipse-plugin,代碼行數:17,代碼來源:AbstractHACCommunicationManager.java

示例11: validateScript

import org.jsoup.helper.StringUtil; //導入方法依賴的package包/類
/**
 * Validate correctness of script language data
 * 
 * @param name
 *            name of a script language
 * @param fileExtension
 *            script language script extension
 * @param isModifi
 *            determinate whether script language is validated as a new one
 *            or modification of existing one.
 * @return true when validation passed, false otherwise.
 */
protected void validateScript(final String name, final String fileExtension) {
	final StringBuilder errorMessage = new StringBuilder();

	if (StringUtil.isBlank(name)) {
		errorMessage.append(Validation.SCRIPT_NAME_BLANK_ERROR + ConsoleUtils.NEW_LINE);
	}

	if (StringUtil.isBlank(fileExtension)) {
		errorMessage.append(Validation.SCRIPT_FILE_EXTENSION_BLANK_ERROR + ConsoleUtils.NEW_LINE);
	}

	if (scriptLanguages.containsKey(name) && !isModification) {
		errorMessage.append(Validation.SCRIPT_LANGUAGE_DUPLICATION_ERROR_MESSAGE + ConsoleUtils.NEW_LINE);
	}

	final Set<String> scriptLanguagesNames = scriptLanguages.entrySet().stream()
			.filter(entry -> Objects.equals(entry.getValue(), fileExtension)).map(Map.Entry::getKey)
			.collect(Collectors.toSet());

	if (scriptLanguagesNames.size() > 0
			&& (!scriptLanguagesNames.contains(name) && !scriptLanguagesNames.contains(oldScriptLanguageName))) {
		errorMessage.append(Validation.SCRIPT_FILE_EXTENSION_DUPLICATION);
	}

	setMessage(errorMessage.toString());
	if (!StringUtil.isBlank(errorMessage.toString())) {
		getButton(IDialogConstants.OK_ID).setEnabled(false);
	} else {
		getButton(IDialogConstants.OK_ID).setEnabled(true);
	}
}
 
開發者ID:SAP,項目名稱:hybris-commerce-eclipse-plugin,代碼行數:44,代碼來源:ScriptLanguageDialog.java

示例12: hintWithAudio

import org.jsoup.helper.StringUtil; //導入方法依賴的package包/類
protected boolean hintWithAudio()
{
  if (!StringUtil.isBlank(this.mAudioUrl))
  {
    this.mActivity.getSoundPlayer().playSoundByUrl(this.mAudioUrl, null);
    return true;
  }
  return false;
}
 
開發者ID:AndyGu,項目名稱:ShanBay,代碼行數:10,代碼來源:ExpSpellView.java

示例13: getAppletList

import org.jsoup.helper.StringUtil; //導入方法依賴的package包/類
public static List<Applet> getAppletList(Context paramContext)
{
  long l = UserCache.userId(paramContext);
  String str = WordSharedPreferencesUtils.getString(paramContext, "com.shanbay.words.applet" + l, "");
  if (StringUtil.isBlank(str))
    return new ArrayList();
  return Model.fromJsonToList(str, Applet.class);
}
 
開發者ID:AndyGu,項目名稱:ShanBay,代碼行數:9,代碼來源:AppletUtil.java

示例14: accept

import org.jsoup.helper.StringUtil; //導入方法依賴的package包/類
public boolean accept(String url,String keyWord) {
	if(url.startsWith(baseUrl)){
		if(StringUtil.isBlank(keyWord)){
			return true;
		}else if(url.indexOf(keyWord)!=-1){
			return true;
		}
	}
	return false;
}
 
開發者ID:cxn945,項目名稱:my_crawler,代碼行數:11,代碼來源:Main.java

示例15: outerHtmlHead

import org.jsoup.helper.StringUtil; //導入方法依賴的package包/類
@Override
void outerHtmlHead(StringBuilder accum, int depth, Document.OutputSettings out) {
    accum.append("<!DOCTYPE");
    if (!StringUtil.isBlank(attr("name")))
        accum.append(" ").append(attr("name"));
    if (!StringUtil.isBlank(attr("publicId")))
        accum.append(" PUBLIC \"").append(attr("publicId")).append('"');
    if (!StringUtil.isBlank(attr("systemId")))
        accum.append(" \"").append(attr("systemId")).append('"');
    accum.append('>');
}
 
開發者ID:shannah,項目名稱:CN1ML-NetbeansModule,代碼行數:12,代碼來源:DocumentType.java


注:本文中的org.jsoup.helper.StringUtil.isBlank方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。