本文整理匯總了Java中org.apache.http.util.TextUtils類的典型用法代碼示例。如果您正苦於以下問題:Java TextUtils類的具體用法?Java TextUtils怎麽用?Java TextUtils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TextUtils類屬於org.apache.http.util包,在下文中一共展示了TextUtils類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: actionPerformed
import org.apache.http.util.TextUtils; //導入依賴的package包/類
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
Project project = anActionEvent.getProject();
if (project != null) {
String packageName = Messages.showInputDialog(
Strings.MESSAGE_ASK_PACKAGE_NAME_TO_FILTER,
Strings.TITLE_ASK_PACKAGE_NAME_TO_FILTER,
Messages.getQuestionIcon(),
PropertiesManager.getData(project, PropertyKeys.PACKAGE_NAME),
new NonEmptyInputValidator());
if (!TextUtils.isEmpty(packageName)) {
PropertiesManager.putData(project, PropertyKeys.PACKAGE_NAME, packageName);
}
}
}
示例2: 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;
}
}
示例3: createSubClassName
import org.apache.http.util.TextUtils; //導入依賴的package包/類
private String createSubClassName(String key, Object o) {
String name = "";
if (o instanceof JSONObject) {
if (TextUtils.isEmpty(key)) {
return key;
}
String[] strings = key.split("_");
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < strings.length; i++) {
stringBuilder.append(StringUtils.captureName(strings[i]));
}
name = stringBuilder.toString() + Config.getInstant().getSuffixStr();
}
return name;
}
示例4: 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();
}
示例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 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();
}
示例6: 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();
}
示例7: onOK
import org.apache.http.util.TextUtils; //導入依賴的package包/類
private void onOK() {
this.setAlwaysOnTop(false);
String jsonSTR = editTP.getText().trim();
if (TextUtils.isEmpty(jsonSTR)) {
return;
}
String generateClassName = generateClassTF.getText().replaceAll(" ", "").replaceAll(".java$", "");
if (TextUtils.isEmpty(generateClassName) || generateClassName.endsWith(".")) {
Toast.make(project, generateClassP, MessageType.ERROR, "the path is not allowed");
return;
}
PsiClass generateClass = null;
if (!currentClass.equals(generateClassName)) {
generateClass = PsiClassUtil.exist(file, generateClassTF.getText());
} else {
generateClass = cls;
}
new ConvertBridge(this, jsonSTR, file, project, generateClass,
cls, generateClassName).run();
}
示例8: 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();
}
示例9: 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;
}
示例10: 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;
}
示例11: sendTextMsg
import org.apache.http.util.TextUtils; //導入依賴的package包/類
/**
* 發送簡單的文本通知給部門所有人
* 目前用於merge請求通過的時候通知所有人員的時候
*
* @param toSpecialUser 是否隻是發給單個用戶,若非empty,則發給指定用戶,否則發給部門所有人
* @param content 要發送的文本內容
*/
public void sendTextMsg(@Nullable String toSpecialUser, String content) {
if (Params.userlist != null) {
Params.userlist.stream()
.filter(bean -> TextUtils.isEmpty(toSpecialUser) || bean.getName().equalsIgnoreCase(toSpecialUser))
.forEach(bean -> {
String userId = bean.getUserid();
MessageTextBean textBean = new MessageTextBean();
textBean.setTouser(userId);
textBean.setAgentid(Params.agentId);
textBean.setMsgtype(MessageType.TEXT);
MessageTextBean.TextBean subTextBean = new MessageTextBean.TextBean();
subTextBean.setContent(content);
textBean.setText(subTextBean);
postNormal("message/send", MessageResponseBean.class, textBean);
});
} else {
getDepartmentMenberList();
}
}
示例12: 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();
}
示例13: getTranslation
import org.apache.http.util.TextUtils; //導入依賴的package包/類
private void getTranslation(AnActionEvent event) {
Editor editor = event.getData(PlatformDataKeys.EDITOR);
if (editor == null) {
return;
}
SelectionModel model = editor.getSelectionModel();
String selectedText = model.getSelectedText();
if (TextUtils.isEmpty(selectedText)) {
selectedText = getCurrentWords(editor);
if (TextUtils.isEmpty(selectedText)) {
return;
}
}
String queryText = strip(addBlanks(selectedText));
new Thread(new RequestRunnable(mTranslator, editor, queryText)).start();
}
示例14: createLocationURI
import org.apache.http.util.TextUtils; //導入依賴的package包/類
@Override
protected URI createLocationURI(String location) throws ProtocolException
{
try
{
final URIBuilder b = new URIBuilder(new URI(encode(location)).normalize());
final String host = b.getHost();
if (host != null)
{
b.setHost(host.toLowerCase(Locale.ROOT));
}
final String path = b.getPath();
if (TextUtils.isEmpty(path))
{
b.setPath("/");
}
return b.build();
}
catch (final URISyntaxException ex)
{
throw new ProtocolException("Invalid redirect URI: " + location, ex);
}
}
示例15: getTranslation
import org.apache.http.util.TextUtils; //導入依賴的package包/類
private void getTranslation(AnActionEvent event) {
Editor mEditor = event.getData(PlatformDataKeys.EDITOR);
Project project = event.getData(PlatformDataKeys.PROJECT);
String basePath = project.getBasePath();
if (null == mEditor) {
return;
}
SelectionModel model = mEditor.getSelectionModel();
String selectedText = model.getSelectedText();
if (TextUtils.isEmpty(selectedText)) {
selectedText = getCurrentWords(mEditor);
if (TextUtils.isEmpty(selectedText)) {
return;
}
}
String queryText = strip(addBlanks(selectedText));
new Thread(new RequestRunnable(mEditor, queryText,basePath)).start();
}