本文整理匯總了Java中org.apache.http.util.TextUtils.isEmpty方法的典型用法代碼示例。如果您正苦於以下問題:Java TextUtils.isEmpty方法的具體用法?Java TextUtils.isEmpty怎麽用?Java TextUtils.isEmpty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.http.util.TextUtils
的用法示例。
在下文中一共展示了TextUtils.isEmpty方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isTargetTagToCount
import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
/**
* valid tag to count
*/
static boolean isTargetTagToCount(PsiElement tag) {
if (tag == null || !(tag instanceof XmlTag) || TextUtils.isEmpty(((XmlTag)tag).getName())) {
return false;
}
String name = ((XmlTag)tag).getName();
return name.equals("array")
|| name.equals("attr")
|| name.equals("bool")
|| name.equals("color")
|| name.equals("declare-styleable")
|| name.equals("dimen")
|| name.equals("drawable")
|| name.equals("eat-comment")
|| name.equals("fraction")
|| name.equals("integer")
|| name.equals("integer-array")
|| name.equals("item")
|| name.equals("plurals")
|| name.equals("string")
|| name.equals("string-array")
|| name.equals("style");
}
示例2: generateLombokFieldText
import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
private String generateLombokFieldText(ClassEntity classEntity, FieldEntity fieldEntity,String fixme) {
fixme = fixme == null ? "" : fixme;
StringBuilder fieldSb = new StringBuilder();
String filedName = fieldEntity.getGenerateFieldName();
if (!TextUtils.isEmpty(classEntity.getExtra())) {
fieldSb.append(classEntity.getExtra()).append("\n");
classEntity.setExtra(null);
}
if (fieldEntity.getTargetClass() != null) {
fieldEntity.getTargetClass().setGenerate(true);
}
if (Config.getInstant().isFieldPrivateMode()) {
fieldSb.append("private ").append(fieldEntity.getFullNameType()).append(" ").append(filedName).append(" ; ");
} else {
fieldSb.append("public ").append(fieldEntity.getFullNameType()).append(" ").append(filedName).append(" ; ");
}
return fieldSb.append(fixme).toString();
}
示例3: actionPerformed
import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
Project project = anActionEvent.getProject();
if (project != null) {
String currentApkPath = PropertiesManager.getData(project, PropertyKeys.APK_PATH);
VirtualFile fileToSelectOnCreate =
TextUtils.isEmpty(currentApkPath)
? project.getBaseDir()
: LocalFileSystem.getInstance().findFileByPath(currentApkPath);
VirtualFile apkFile = new FileChooserDialogManager.Builder(project, fileToSelectOnCreate)
.setFileTypes(FileTypes.FILE)
.setTitle(Strings.TITLE_ASK_APK_FILE)
.setDescription(Strings.MESSAGE_ASK_APK_FILE)
.withFileFilter("apk")
.create()
.getSelectedFile();
if (apkFile != null) {
PropertiesManager.putData(project, PropertyKeys.APK_PATH, apkFile.getPath());
}
}
}
示例4: generateFieldText
import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
private String generateFieldText(ClassEntity classEntity, FieldEntity fieldEntity, String fixme) {
fixme = fixme == null ? "" : fixme;
StringBuilder fieldSb = new StringBuilder();
String fieldName = fieldEntity.getGenerateFieldName();
if (!TextUtils.isEmpty(classEntity.getExtra())) {
fieldSb.append(classEntity.getExtra()).append("\n");
classEntity.setExtra(null);
}
if (!fieldName.equals(fieldEntity.getKey()) || Config.getInstant().isUseSerializedName()) {
fieldSb.append(Constant.gsonFullNameAnnotation.replaceAll("\\{filed\\}", fieldEntity.getKey()));
}
if (fieldEntity.getTargetClass() != null) {
fieldEntity.getTargetClass().setGenerate(true);
}
return fieldSb.append(String.format("public abstract %s %s(); " + fixme, fieldEntity.getFullNameType(), fieldName)).toString();
}
示例5: generateFieldText
import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
private String generateFieldText(ClassEntity classEntity, FieldEntity fieldEntity, String fixme) {
fixme = fixme == null ? "" : fixme;
StringBuilder fieldSb = new StringBuilder();
String filedName = fieldEntity.getGenerateFieldName();
if (!TextUtils.isEmpty(classEntity.getExtra())) {
fieldSb.append(classEntity.getExtra()).append("\n");
classEntity.setExtra(null);
}
if (fieldEntity.getTargetClass() != null) {
fieldEntity.getTargetClass().setGenerate(true);
}
if (!filedName.equals(fieldEntity.getKey()) || Config.getInstant().isUseSerializedName()) {
fieldSb.append(Config.getInstant().geFullNameAnnotation().replaceAll("\\{filed\\}", fieldEntity.getKey()));
}
if (Config.getInstant().isFieldPrivateMode()) {
fieldSb.append("private ").append(fieldEntity.getFullNameType()).append(" ").append(filedName).append(" ; ");
} else {
fieldSb.append("public ").append(fieldEntity.getFullNameType()).append(" ").append(filedName).append(" ; ");
}
return fieldSb.append(fixme).toString();
}
示例6: captureStringLeaveUnderscore
import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
/**
* 轉成駝峰
*
* @param text
* @return
*/
public static String captureStringLeaveUnderscore(String text) {
if (TextUtils.isEmpty(text)) {
return text;
}
String temp = text.replaceAll("^_+", "");
if (!TextUtils.isEmpty(temp)) {
text = temp;
}
String[] strings = text.split("_");
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(strings[0]);
for (int i = 1; i < strings.length; i++) {
stringBuilder.append(captureName(strings[i]));
}
return stringBuilder.toString();
}
示例7: postNormal
import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
private <T> T postNormal(String actionName, Class<T> tClass, Object linkBean) {
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(linkBean));
Request request = new Request.Builder().url(getFullUrl(actionName)).post(body).build();
T ret = null;
String result = null;
try {
Response response = getOkHttp().newCall(request).execute();
result = response.body().string();
if (!TextUtils.isEmpty(result)) {
// if (result.contains("error_code")) {
// mLogger.error("postForm result error ,actionName = " + actionName + " ,detail : " + result);
// } else {
ret = gson.fromJson(result, tClass);
// }
}
System.out.println("post成功 result = " + result);
} catch (Exception e) {
mLogger.error("postForm IOException1 action: " + actionName + " ," + tClass.getName() + " ,detail: " + e.getMessage() + ",resultStr = " + result);
e.printStackTrace();
}
return ret;
}
示例8: getFullUrl
import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
/**
* 生成get方法完整url地址: https://www.okcoin.com/api/v1/future_index.do?symbol=btc_usd
*
* @param actionName 請求動作名稱:future_index.do
* @param contents 查詢參數: symbol,btc_usd
*/
private String getFullUrl(String actionName, String... contents) {
if (TextUtils.isEmpty(Params.accessToken)) {
System.out.println("access_token非法 " + Params.accessToken);
}
// 這個是釘釘要加的,都統一加上吧,暫時沒發現問題,就不做特殊處理了
String result = "?access_token=" + Params.accessToken + "&";
if (contents != null && contents.length > 0 && contents.length % 2 == 0) {
for (int i = 0; i < contents.length - 1; i += 2) {
result += contents[i] + "=" + contents[i + 1] + "&";
}
}
if (!TextUtils.isEmpty(result)) {
result = result.substring(0, result.length() - 1);
}
return Params.getDingTalkServerUrl() + actionName + result;
}
示例9: setValueAt
import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
@Override
public void setValueAt(int column, String text) {
switch (column) {
case 2:
break;
case 3:
String result;
if (!TextUtils.isEmpty(fieldTypeSuffix)) {
result = fieldTypeSuffix + "." + text;
} else {
result = text;
}
if (CheckUtil.getInstant().containsDeclareClassName(result)) {
return;
}
CheckUtil.getInstant().removeDeclareClassName(getQualifiedName());
setClassName(text);
break;
}
}
示例10: apply
import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
@Override
public void apply() throws ConfigurationException {
try {
PropertiesComponent.getInstance().setValue(KEY_RULES_PATH, rulesPath.getText());
if (!TextUtils.isEmpty(rulesPath.getText())) {
load(rulesPath.getText());
DirectiveLint.prepare();
} else {
DirectiveLint.reset();
}
} catch (Exception e) {
ProjectUtil.guessCurrentProject(select).getMessageBus().syncPublisher(Notifications.TOPIC).notify(
new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID,
"Weex language support - bad rules",
e.toString(),
NotificationType.ERROR));
}
savePaths();
}
示例11: queryWxUserNick
import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
public String queryWxUserNick(String openId) throws IOException {
String nick = userNickMap.get(openId);
if (TextUtils.isEmpty(nick)) {
String url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=%s&openid=%s&lang=zh_CN";
url = String.format(url, wxAuthService.queryAccessToken(), openId);
String res = HttpClientPool.getInstance().get(url);
if (TextUtils.isEmpty(res)) {
return null;
} else {
JSONObject json = JSONObject.parseObject(res);
nick = json.getString("nickname");
userNickMap.put(openId, nick);
// 更新到七魚
updateWxUserToQiyu(openId, json);
}
}
return nick;
}
示例12: match
import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
public boolean match(String value) {
if (TextUtils.isEmpty(valuePattern)) {
return false;
}
if (valuePattern.toLowerCase().equals("mustache")) {
return Pattern.compile("\\{\\{.*\\}\\}").matcher(value).matches();
} else if (valuePattern.toLowerCase().equals("number")) {
return Pattern.compile("[0-9]+([.][0-9]+)?$").matcher(value).matches();
} else if (valuePattern.toLowerCase().equals("boolean")) {
return Pattern.compile("(true|false)$").matcher(value).matches();
} else {
try {
return Pattern.compile(valuePattern).matcher(value).matches();
} catch (Exception e) {
return false;
}
}
}
示例13: onClick
import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.btnregister:
username = edtname.getText().toString();
password = edtpass.getText().toString();
email = edtmail.getText().toString();
if (TextUtils.isEmpty(username)){
edtname.setError(username);
} else if(TextUtils.isEmpty(password)){
edtpass.setError("Enter Password");
}else if(TextUtils.isEmpty(email)){
edtmail.setError("Enter Password");
}
else
SendRegRequest();
}
}
示例14: onClick
import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btnlogin:
username = name.getText().toString();
password = pass.getText().toString();
if(TextUtils.isEmpty(username))
{
name.setError("Enter Name");
}
else if(TextUtils.isEmpty(password)){
pass.setError("Enter Password");
}
else {
SendJsonRequest();
}
break;
case R.id.btnregister:
Intent it = new Intent(LoginActivity.this,RegistrationActivity.class);
startActivity(it);
break;
}
}
示例15: getBotToken
import org.apache.http.util.TextUtils; //導入方法依賴的package包/類
@Override
public String getBotToken() {
if (TextUtils.isEmpty(token)) {
final Properties properties = new Properties();
try {
properties.load(properties.getClass().getResourceAsStream("/secret.properties"));
} catch (IOException e) {
throw new RuntimeException("No secret.properties with telegram token found in resources/");
}
token = properties.getProperty("token");
if (TextUtils.isEmpty(token)) {
throw new RuntimeException("No telegram token found in resources/secret.properties");
}
return token;
}
return token;
}