本文整理汇总了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);
}
}
}
示例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());
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
}
示例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;
}
}
示例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();
}
示例12: editTask
import com.google.common.base.Strings; //导入方法依赖的package包/类
@Override
public void editTask() {
if (Strings.isNullOrEmpty(mTaskId)) {
mTaskDetailView.showMissingTask();
return;
}
mTaskDetailView.showEditTask(mTaskId);
}
示例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 );
}
示例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));
}
示例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;
}