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


Java Strings.isNullOrEmpty方法代碼示例

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


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

示例1: renderDebugInfoRight

import com.google.common.base.Strings; //導入方法依賴的package包/類
protected void renderDebugInfoRight(ScaledResolution p_175239_1_)
{
    List list = this.getDebugInfoRight();

    for (int i = 0; i < list.size(); ++i)
    {
        String s = (String)list.get(i);

        if (!Strings.isNullOrEmpty(s))
        {
            int j = this.fontRenderer.FONT_HEIGHT;
            int k = this.fontRenderer.getStringWidth(s);
            int l = p_175239_1_.getScaledWidth() - 2 - k;
            int i1 = 2 + j * i;
            drawRect(l - 1, i1 - 1, l + k + 1, i1 + j - 1, -1873784752);
            this.fontRenderer.drawString(s, l, i1, 14737632);
        }
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:20,代碼來源:GuiOverlayDebug.java

示例2: processServiceReferenceMetadata

import com.google.common.base.Strings; //導入方法依賴的package包/類
private void processServiceReferenceMetadata(final MutableServiceReferenceMetadata serviceRef) {
    if (!useDefaultForReferenceTypes) {
        return;
    }

    String filter = serviceRef.getFilter();
    String extFilter = serviceRef.getExtendedFilter() == null ? null :
        serviceRef.getExtendedFilter().getStringValue();

    LOG.debug("{}: processServiceReferenceMetadata for {}, filter: {}, ext filter: {}", logName(),
            serviceRef.getId(), filter, extFilter);

    if (Strings.isNullOrEmpty(filter) && Strings.isNullOrEmpty(extFilter)) {
        serviceRef.setFilter(DEFAULT_TYPE_FILTER);

        LOG.debug("{}: processServiceReferenceMetadata for {} set filter to {}", logName(),
                serviceRef.getId(), serviceRef.getFilter());
    }
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:20,代碼來源:ComponentProcessor.java

示例3: run

import com.google.common.base.Strings; //導入方法依賴的package包/類
@Override
public void run() {
    long startTime = System.currentTimeMillis();
    String uri = (String) server.get("uri");
    try {
        if (!Strings.isNullOrEmpty(uri)) {
            String displayName = (String) server.get("displayName");
            String serverPrefix;
            if (!Strings.isNullOrEmpty(displayName)) {
                serverPrefix = configuration.getMetricPrefix() + "|" + displayName + "|";
            } else {
                serverPrefix = configuration.getMetricPrefix() + "|";
            }
            logger.debug("Fetching metrics for the server uri=" + uri + ",metricPrefix =" + serverPrefix);
            fetchMetrics(serverPrefix);
        }
    } catch (Exception e) {
        String msg = "Exception while running the MarkLogic task in the server " + uri;
        logger.error(msg, e);
        configuration.getMetricWriter().registerError(msg, e);
    } finally {
        long endTime = System.currentTimeMillis() - startTime;
        logger.debug("MarkLogic monitor thread for server " + uri + " ended. Time taken is " + endTime);
    }

}
 
開發者ID:Appdynamics,項目名稱:marklogic-monitoring-extension,代碼行數:27,代碼來源:MarkLogicMonitorTask.java

示例4: buildCommandArgs

import com.google.common.base.Strings; //導入方法依賴的package包/類
private List<String> buildCommandArgs(String scriptPath) {
    StringBuilder shell = new StringBuilder();
    if (!Strings.isNullOrEmpty(pythonConfig.getPyenv())) {
        shell.append("pyenv shell ").append(pythonConfig.getPyenv()).append("; ");

        if (!Strings.isNullOrEmpty(pythonConfig.getVirtualenv())) {
            shell.append("export PYENV_VIRTUALENV_DISABLE_PROMPT=1; ");
            shell.append("pyenv activate ").append(pythonConfig.getVirtualenv()).append("; ");
        }
        shell.append("python ").append(scriptPath);
    }

    List<String> com;
    if (!Strings.isNullOrEmpty(pythonConfig.getPythonBinPath())) {
        com = Lists.newArrayList(pythonConfig.getPythonBinPath(), scriptPath);
    } else if (shell.length() != 0) {
        // -l: Use login shell
        com = Lists.newArrayList("bash", "-l", "-c", shell.toString());
    } else {
        // system's default
        com = Lists.newArrayList("python", scriptPath);
    }

    LOGGER.debug("Commands... : {}", com);
    return com;
}
 
開發者ID:sh0nk,項目名稱:matplotlib4j,代碼行數:27,代碼來源:PyCommand.java

示例5: createProjectUri

import com.google.common.base.Strings; //導入方法依賴的package包/類
/**
 * Creates project {@link URI} for the given file system location.
 *
 * @param location
 *            file system location to transform
 * @return {@link URI} for the provided location
 */
private static URI createProjectUri(File location) {
	URI createURI = null;
	try {
		createURI = URI.createURI(location.toURI().toURL().toString());
		// by convention IN4JSProject URI does not end with '/'
		// i.e. last segment is not empty
		if (Strings.isNullOrEmpty(createURI.lastSegment())) {
			createURI = createURI.trimSegments(DANGLING_SEGMENT_COUNT);
		}
	} catch (MalformedURLException e) {
		LOGGER.warn("Exceptions when transforming location: " + location, e);
	}
	return createURI;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:22,代碼來源:RunnerN4JSCore.java

示例6: getDisplayName

import com.google.common.base.Strings; //導入方法依賴的package包/類
@Override
public String getDisplayName() {
    String txt;
    if (Strings.isNullOrEmpty(libraryName)) {
        txt = "project '" + projectPath + "'";
    } else if (Strings.isNullOrEmpty(variant)) {
        txt = "project '" + projectPath + "' library '" + libraryName + "'";
    } else {
        txt = "project '" + projectPath + "' library '" + libraryName + "' binary '" + variant + "'";
    }
    return txt;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:13,代碼來源:DefaultLibraryComponentSelector.java

示例7: getAppId

import com.google.common.base.Strings; //導入方法依賴的package包/類
/**
 * Get the app id for the current application.
 *
 * @return the app id or ConfigConsts.NO_APPID_PLACEHOLDER if app id is not available
 */
public String getAppId() {
  String appId = Foundation.app().getAppId();
  if (Strings.isNullOrEmpty(appId)) {
    appId = ConfigConsts.NO_APPID_PLACEHOLDER;
    logger.warn("app.id is not set, please make sure it is set in classpath:/META-INF/app.properties, now apollo " +
        "will only load public namespace configurations!");
  }
  return appId;
}
 
開發者ID:dewey-its,項目名稱:apollo-custom,代碼行數:15,代碼來源:ConfigUtil.java

示例8: describeHelper

import com.google.common.base.Strings; //導入方法依賴的package包/類
private static void describeHelper(final String options, final String describeCmd) throws Exception {
  final TestBuilder builder = testBuilder();

  if (!Strings.isNullOrEmpty(options)) {
    builder.optionSettingQueriesForTestQuery(options);
  }

  builder.sqlQuery(describeCmd)
      .unOrdered()
      .baselineColumns(baselineCols)
      .baselineValues(expVal1)
      .baselineValues(expVal2)
      .go();
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:15,代碼來源:TestInfoSchemaOnHiveStorage.java

示例9: absoluteFileName

import com.google.common.base.Strings; //導入方法依賴的package包/類
private String absoluteFileName(Context ctx) {
    String dir = ctx.packageName.replace('.', '/');
    if (Strings.isNullOrEmpty(dir)) {
        return ctx.fileName;
    } else {
        return dir + "/" + ctx.fileName;
    }
}
 
開發者ID:salesforce,項目名稱:grpc-java-contrib,代碼行數:9,代碼來源:Jdk8Generator.java

示例10: isVerbose

import com.google.common.base.Strings; //導入方法依賴的package包/類
protected boolean isVerbose() {
    if (Strings.isNullOrEmpty(logLevel)) {
        return false;
    }
    try {
        return (Integer.parseInt(logLevel) > 0);
    } catch (Throwable t) {
        return false;
    }
}
 
開發者ID:openshift,項目名稱:jenkins-client-plugin,代碼行數:11,代碼來源:BaseStep.java

示例11: reset

import com.google.common.base.Strings; //導入方法依賴的package包/類
@Override
public void reset() {
    super.reset();
    if (!Strings.isNullOrEmpty(getTextEntryPresenter().getText())) {
        presenter.setText(StringUtils.EMPTY_STRING);
        updateResponse(false, true);
    }
    sourcelistManager.onUserValueChanged();
}
 
開發者ID:YoungDigitalPlanet,項目名稱:empiria.player,代碼行數:10,代碼來源:TextEntryGapBase.java

示例12: editTask

import com.google.common.base.Strings; //導入方法依賴的package包/類
@Override
public void editTask() {
    if (Strings.isNullOrEmpty(mTaskId)) {
        mTaskDetailView.showMissingTask();
        return;
    }
    mTaskDetailView.showEditTask(mTaskId);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:9,代碼來源:TaskDetailPresenter.java

示例13: insertString

import com.google.common.base.Strings; //導入方法依賴的package包/類
@Override
public void insertString( int iOffset, String str, AttributeSet a ) throws BadLocationException
{
  if( Strings.isNullOrEmpty( str ) )
  {
    return;
  }

  String strText = IdentifierTextField.this.getText();
  StringBuilder strbText = new StringBuilder( Strings.nullToEmpty( strText ) );

  if( iOffset <= strbText.length() )
  {
    strbText.insert( iOffset, str );
  }
  else
  {
    strbText.append( str );
  }

  if( !isValidIdentifier( strbText, _bAcceptDot ) || strbText.toString().contains( "$" ) )
  {
    String validID = makeValidIdentifier( strbText.toString(), _bAcceptDot, _bAcceptUnderscore );
    if( !_bAcceptUnderscore )
    {
      validID = validID.replace( "$", "" );
    }
    str = validID.substring( iOffset, iOffset + (validID.length() - strText.length()) );
  }

  super.insertString( iOffset, str, a );
}
 
開發者ID:manifold-systems,項目名稱:manifold-ij,代碼行數:33,代碼來源:IdentifierTextField.java

示例14: parseCommand

import com.google.common.base.Strings; //導入方法依賴的package包/類
/**
 * 判斷是否為特殊命令 key的格式:schema.table.schema_hash
 */
public static Command parseCommand(String key) {
    if (Strings.isNullOrEmpty(key)) {
        return Command.UNKNOWN_CMD;
    }

    int lastIdx = key.lastIndexOf(".");
    if (lastIdx <= 0) {
        return Command.parse(key);
    }
    return Command.parse(key.substring(0, lastIdx));
}
 
開發者ID:BriData,項目名稱:DBus,代碼行數:15,代碼來源:Utils.java

示例15: isKerberosPropertySetted

import com.google.common.base.Strings; //導入方法依賴的package包/類
public static boolean isKerberosPropertySetted() {
  String krbPrincipal = System.getProperty(KRB_PRINCIPAL);
  String krbKeytab = System.getProperty(KRB_KEYTAB_FILE);
  if (Strings.isNullOrEmpty(krbPrincipal) || Strings.isNullOrEmpty(krbKeytab)) {
    return false;
  }
  return true;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:9,代碼來源:HBaseKerberosUtils.java


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