本文整理汇总了Java中joptsimple.internal.Strings.isNullOrEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java Strings.isNullOrEmpty方法的具体用法?Java Strings.isNullOrEmpty怎么用?Java Strings.isNullOrEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类joptsimple.internal.Strings
的用法示例。
在下文中一共展示了Strings.isNullOrEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toString
import joptsimple.internal.Strings; //导入方法依赖的package包/类
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("MethodTransformer [");
builder.append(getMethod() != null ? getMethod().toString() : "null");
builder.append("] ");
if(tasks.isEmpty()) builder.append("No transform tasks");
else {
builder.append("Found ");
builder.append(tasks.size());
builder.append(" transform tasks: ");
Iterator<TaskElement> it = tasks.iterator();
while (it.hasNext()) {
TaskElement next = it.next();
String desc = next.getMethod().getDeclaredAnnotation(Inject.class).description();
if(!Strings.isNullOrEmpty(desc)) {
builder.append(desc);
}
if(it.hasNext()) builder.append(", ");
}
}
return builder.toString();
}
示例2: lookup
import joptsimple.internal.Strings; //导入方法依赖的package包/类
@Override
protected Field lookup() throws Exception {
for(State state : State.values()) {
String n = name.getByState(state);
if(!Strings.isNullOrEmpty(n)) try {
Field f = insideClass.getDeclaredField(n);
f.setAccessible(true);
if(stripFinal) {
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(f, f.getModifiers() & ~Modifier.FINAL);
}
return f;
} catch (Exception e) {
;
}
}
return null;
}
示例3: extract
import joptsimple.internal.Strings; //导入方法依赖的package包/类
private static boolean extract(String message, Pattern[] patterns, BiConsumer<GameProfile, String> callback) {
for(Pattern pattern : patterns) {
Matcher matcher = pattern.matcher(message);
if (matcher.find()) {
final String messageSender = matcher.group(1);
final String messageOnly = matcher.group(2);
if (!Strings.isNullOrEmpty(messageSender)) {
for (NetworkPlayerInfo data : getLocalPlayer().connection.getPlayerInfoMap()) {
if (String.CASE_INSENSITIVE_ORDER.compare(messageSender, data.getGameProfile().getName()) == 0) {
callback.accept(data.getGameProfile(), messageOnly);
return true;
}
}
}
}
}
return false;
}
示例4: validate
import joptsimple.internal.Strings; //导入方法依赖的package包/类
/**
* Verifies that String and numeric values are within their allowed ranges, then ensures that term vectors are
* properly enabled on the target index.
*
* @param query
* the String query to expand
* @param fbDocs
* the int number of feedback documents
* @param fbTerms
* the int number of feedback terms
* @return the String error message, or null if no errors are encountered
* @throws IOException
* if the indexMetaData fails to deserialize into a map
*/
public String validate(String query, int fbDocs, int fbTerms) throws IOException {
if (Strings.isNullOrEmpty(query)) {
return NULL_QUERY_ERROR;
} else if (fbDocs < 1) {
return INVALID_FB_DOCS_ERROR;
} else if (fbTerms < 1) {
return INVALID_FB_TERMS_ERROR;
} else if (Strings.isNullOrEmpty(index)) {
return NULL_INDEX_ERROR;
} else if (Strings.isNullOrEmpty(type)) {
return NULL_TYPE_ERROR;
} else if (Strings.isNullOrEmpty(field)) {
return NULL_FIELD_ERROR;
} else if (ALPHA_BETA_MIN > alpha || alpha > ALPHA_BETA_MAX) {
return INVALID_ALPHA_ERROR;
} else if (ALPHA_BETA_MIN > beta || beta > ALPHA_BETA_MAX) {
return INVALID_BETA_ERROR;
} else if (K1_MIN > k1 || k1 > K1_MAX) {
return INVALID_K1_ERROR;
} else if (B_MIN > b || b > B_MAX) {
return INVALID_B_ERROR;
}
return this.ensureTermVectors();
}
示例5: formattedHelpOutput
import joptsimple.internal.Strings; //导入方法依赖的package包/类
private String formattedHelpOutput() {
StringBuilder formatted = new StringBuilder();
formatted.append(LINE_SEPARATOR);
String commandsDisplay = commandRows.render();
if (!Strings.isNullOrEmpty(commandsDisplay)) {
formatted.append(commandsDisplay)
.append(LINE_SEPARATOR)
.append(LINE_SEPARATOR);
}
formatted.append(optionRows.render());
formatted.append(LINE_SEPARATOR);
return formatted.toString();
}
示例6: createDocString
import joptsimple.internal.Strings; //导入方法依赖的package包/类
private static String createDocString(IMethodDescription desc) {
// (arg:type[, optionArg:type]):resultType -- Description
List<String> args = Lists.newArrayList();
for (IArgumentDescription arg : desc.arguments())
args.add(arg.name() + ":" + decorate(arg.type().describe(), arg));
final IScriptType returnTypes = desc.returnTypes();
String argsJoined = Joiner.on(',').join(args);
String argsAndResult;
if (TypeHelper.isVoid(returnTypes)) {
argsAndResult = String.format("(%s)", argsJoined);
} else {
final String ret = returnTypes.describe();
argsAndResult = String.format("(%s):%s", argsJoined, ret);
}
return !Strings.isNullOrEmpty(desc.description())? argsAndResult + " -- " + desc.description() : argsAndResult;
}
示例7: createPeripheralHelpText
import joptsimple.internal.Strings; //导入方法依赖的package包/类
public static String createPeripheralHelpText(Class<? extends Object> cls, String type, IMethodMap methods) {
StringBuilder builder = new StringBuilder();
builder.append("----OpenPeripheral doc----\n");
builder.append("Peripheral type: ");
builder.append(type);
builder.append("\n\n");
final String docText = DOC_TEXT_CACHE.getOrCreate(cls);
if (!Strings.isNullOrEmpty(docText)) {
builder.append(docText);
builder.append("\n\n");
}
builder.append("---Methods---\n");
listMethods(builder, methods);
return builder.toString();
}
示例8: lookup
import joptsimple.internal.Strings; //导入方法依赖的package包/类
@Override
protected Method lookup() throws Exception {
Objects.requireNonNull(parameters);
for(State state : State.values()) {
String n = name.getByState(state);
if(!Strings.isNullOrEmpty(n)) try {
Method m = insideClass.getDeclaredMethod(n, parameters);
m.setAccessible(true);
return m;
} catch (Exception e) {
;
}
}
return null;
}
示例9: setStoplist
import joptsimple.internal.Strings; //导入方法依赖的package包/类
private Stopper setStoplist(String stoplist) {
this.stopper = new Stopper(DEFAULT_STOPPER);
// Short-circuit for null stoplist
if (!Strings.isNullOrEmpty(stoplist)) {
String[] stopwords = stoplist.split(" ");
for (String term : stopwords) {
stopper.addStopword(term);
}
}
return stopper;
}
示例10: getPrefix
import joptsimple.internal.Strings; //导入方法依赖的package包/类
String getPrefix(final String metric) {
if (Strings.isNullOrEmpty(metric)) {
return DEFAULT_COUNTER_ID;
}
int idx = metric.indexOf(".");
if (idx < 1) {
return DEFAULT_COUNTER_ID;
}
return metric.substring(0, idx);
}
示例11: hasSameCompressor
import joptsimple.internal.Strings; //导入方法依赖的package包/类
private boolean hasSameCompressor(final RegionAttributes<?, ?> ra) {
Compressor raCompressor = ra.getCompressor();
if (raCompressor == null) {
return Strings.isNullOrEmpty(getCompressorClassName()) ? true : false;
}
return raCompressor.getClass().getName().equals(getCompressorClassName());
}
示例12: hasSameCompressor
import joptsimple.internal.Strings; //导入方法依赖的package包/类
private boolean hasSameCompressor(final RegionAttributes<?,?> ra) {
Compressor raCompressor = ra.getCompressor();
if (raCompressor == null) {
return Strings.isNullOrEmpty(getCompressorClassName()) ? true : false;
}
return raCompressor.getClass().getName().equals(getCompressorClassName());
}
示例13: formattedHelpOutput
import joptsimple.internal.Strings; //导入方法依赖的package包/类
private String formattedHelpOutput() {
StringBuilder formatted = new StringBuilder();
String nonOptionDisplay = nonOptions.render();
if ( !Strings.isNullOrEmpty(nonOptionDisplay) )
formatted.append( nonOptionDisplay ).append( LINE_SEPARATOR );
formatted.append(options.render());
return formatted.toString();
}
示例14: appendTypeIndicator
import joptsimple.internal.Strings; //导入方法依赖的package包/类
private void appendTypeIndicator( StringBuilder buffer, String typeIndicator, String description,
char start, char end ) {
buffer.append( ' ' ).append( start );
if ( typeIndicator != null )
buffer.append( typeIndicator );
if ( !Strings.isNullOrEmpty( description ) ) {
if ( typeIndicator != null )
buffer.append( ": " );
buffer.append( description );
}
buffer.append( end );
}
示例15: read
import joptsimple.internal.Strings; //导入方法依赖的package包/类
private String read(T question) {
String value = scanner.nextLine();
if (Strings.isNullOrEmpty(value))
value = question.getValue();
return value;
}