當前位置: 首頁>>代碼示例>>Java>>正文


Java TextUtils類代碼示例

本文整理匯總了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);
        }
    }
}
 
開發者ID:kaygisiz,項目名稱:Dependency-Injection-Graph,代碼行數:19,代碼來源:SetPackageFilter.java

示例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;
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:ClassEntity.java

示例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;

}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:17,代碼來源:ConvertBridge.java

示例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();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:LombokProcessor.java

示例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();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:17,代碼來源:AutoValueProcessor.java

示例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();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:23,代碼來源:Processor.java

示例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();
    }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:23,代碼來源:JsonDialog.java

示例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();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:24,代碼來源:StringUtils.java

示例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;
}
 
開發者ID:lucid-lynxz,項目名稱:Webhook_server,代碼行數:23,代碼來源:HttpUtil.java

示例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;
}
 
開發者ID:lucid-lynxz,項目名稱:Webhook_server,代碼行數:23,代碼來源:HttpUtil.java

示例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();
    }
}
 
開發者ID:lucid-lynxz,項目名稱:Webhook_server,代碼行數:30,代碼來源:HttpUtil.java

示例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();
}
 
開發者ID:zeng198821,項目名稱:CodeGenerate,代碼行數:21,代碼來源:LombokProcessor.java

示例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();
}
 
開發者ID:a483210,項目名稱:GoogleTranslation,代碼行數:17,代碼來源:GoogleTranslation.java

示例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);
    }
}
 
開發者ID:PaleoCrafter,項目名稱:CurseSync,代碼行數:24,代碼來源:SafeRedirectStrategy.java

示例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();
}
 
開發者ID:BolexLiu,項目名稱:ReciteWords,代碼行數:20,代碼來源:ReciteWords.java


注:本文中的org.apache.http.util.TextUtils類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。