当前位置: 首页>>代码示例>>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;未经允许,请勿转载。