当前位置: 首页>>代码示例>>Java>>正文


Java LintUtils.findSubstring方法代码示例

本文整理汇总了Java中com.android.tools.lint.detector.api.LintUtils.findSubstring方法的典型用法代码示例。如果您正苦于以下问题:Java LintUtils.findSubstring方法的具体用法?Java LintUtils.findSubstring怎么用?Java LintUtils.findSubstring使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.android.tools.lint.detector.api.LintUtils的用法示例。


在下文中一共展示了LintUtils.findSubstring方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getOldValue

import com.android.tools.lint.detector.api.LintUtils; //导入方法依赖的package包/类
/**
 * Given an error message produced by this lint detector,
 * returns the old value to be replaced in the source code.
 * <p>
 * Intended for IDE quickfix implementations.
 *
 * @param errorMessage the error message associated with the error
 * @param format the format of the error message
 * @return the corresponding old value, or null if not recognized
 */
@Nullable
public static String getOldValue(@NonNull String errorMessage,
        @NonNull TextFormat format) {
    errorMessage = format.toText(errorMessage);
    String attribute = LintUtils.findSubstring(errorMessage, " should use ", " ");
    if (attribute == null) {
        attribute = LintUtils.findSubstring(errorMessage, " should use ", null);
    }
    if (attribute != null) {
        int index = attribute.indexOf(':');
        if (index != -1) {
            return ANDROID_NS_NAME + attribute.substring(index);
        }
    }

    return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:GridLayoutDetector.java

示例2: getNewValue

import com.android.tools.lint.detector.api.LintUtils; //导入方法依赖的package包/类
/**
 * Given an error message produced by this lint detector,
 * returns the new value to be put into the source code.
 * <p>
 * Intended for IDE quickfix implementations.
 *
 * @param errorMessage the error message associated with the error
 * @param format the format of the error message
 * @return the corresponding new value, or null if not recognized
 */
@Nullable
public static String getNewValue(@NonNull String errorMessage,
        @NonNull TextFormat format) {
    errorMessage = format.toText(errorMessage);
    String attribute = LintUtils.findSubstring(errorMessage, " should use ", " ");
    if (attribute == null) {
        attribute = LintUtils.findSubstring(errorMessage, " should use ", null);
    }
    return attribute;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:GridLayoutDetector.java

示例3: getOldValue

import com.android.tools.lint.detector.api.LintUtils; //导入方法依赖的package包/类
/**
 * Given an error message produced by this lint detector for the given issue type,
 * returns the old value to be replaced in the source code.
 * <p>
 * Intended for IDE quickfix implementations.
 *
 * @param issue the corresponding issue
 * @param errorMessage the error message associated with the error
 * @param format the format of the error message
 * @return the corresponding old value, or null if not recognized
 */
@Nullable
public static String getOldValue(@NonNull Issue issue, @NonNull String errorMessage,
        @NonNull TextFormat format) {
    if (issue == INNERCLASS) {
        errorMessage = format.toText(errorMessage);
        return LintUtils.findSubstring(errorMessage, " replace \"", "\"");
    }

    return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:MissingClassDetector.java

示例4: getNewValue

import com.android.tools.lint.detector.api.LintUtils; //导入方法依赖的package包/类
/**
 * Given an error message produced by this lint detector for the given issue type,
 * returns the new value to be put into the source code.
 * <p>
 * Intended for IDE quickfix implementations.
 *
 * @param issue the corresponding issue
 * @param errorMessage the error message associated with the error
 * @param format the format of the error message
 * @return the corresponding new value, or null if not recognized
 */
@Nullable
public static String getNewValue(@NonNull Issue issue, @NonNull String errorMessage,
        @NonNull TextFormat format) {
    if (issue == INNERCLASS) {
        errorMessage = format.toText(errorMessage);
        return LintUtils.findSubstring(errorMessage, " with \"", "\"");
    }
    return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:MissingClassDetector.java

示例5: getSuggestedEscape

import com.android.tools.lint.detector.api.LintUtils; //导入方法依赖的package包/类
/**
 * Returns the escaped string value suggested by the error message which should have
 * been computed by this lint detector.
 *
 * @param message the error message created by this lint detector
 * @param format the format of the error message
 * @return the suggested escaped value
 */
@Nullable
public static String getSuggestedEscape(@NonNull String message, @NonNull TextFormat format) {
    return LintUtils.findSubstring(format.toText(message), "; use ", null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:PropertyFileDetector.java

示例6: getExpectedType

import com.android.tools.lint.detector.api.LintUtils; //导入方法依赖的package包/类
/**
 * Returns the resource type expected for a {@link #TYPE_MISMATCH} error reported by
 * this lint detector. Intended for IDE quickfix implementations.
 *
 * @param message the error message created by this lint detector
 * @param format the format of the error message
 */
public static String getExpectedType(@NonNull String message, @NonNull TextFormat format) {
    return LintUtils.findSubstring(format.toText(message), "value of type @", "/");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:DuplicateResourceDetector.java

示例7: getOldValue

import com.android.tools.lint.detector.api.LintUtils; //导入方法依赖的package包/类
/**
 * Given an error message produced by this lint detector for the given issue type,
 * returns the old value to be replaced in the source code.
 * <p>
 * Intended for IDE quickfix implementations.
 *
 * @param errorMessage the error message associated with the error
 * @param format the format of the error message
 * @return the corresponding old value, or null if not recognized
 */
@Nullable
public static String getOldValue(@NonNull String errorMessage, @NonNull TextFormat format) {
    errorMessage = format.toText(errorMessage);
    return LintUtils.findSubstring(errorMessage, "than \"", "\"");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:WrongCallDetector.java

示例8: getNewValue

import com.android.tools.lint.detector.api.LintUtils; //导入方法依赖的package包/类
/**
 * Given an error message produced by this lint detector for the given issue type,
 * returns the new value to be put into the source code.
 * <p>
 * Intended for IDE quickfix implementations.
 *
 * @param errorMessage the error message associated with the error
 * @param format the format of the error message
 * @return the corresponding new value, or null if not recognized
 */
@Nullable
public static String getNewValue(@NonNull String errorMessage, @NonNull TextFormat format) {
    errorMessage = format.toText(errorMessage);
    return LintUtils.findSubstring(errorMessage, "call \"", "\"");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:WrongCallDetector.java

示例9: getOldValue

import com.android.tools.lint.detector.api.LintUtils; //导入方法依赖的package包/类
/**
 * Given an error message produced by this lint detector for the given issue type,
 * returns the old value to be replaced in the source code.
 * <p>
 * Intended for IDE quickfix implementations.
 *
 * @param errorMessage the error message associated with the error
 * @param format the format of the error message
 * @return the corresponding old value, or null if not recognized
 */
@Nullable
public static String getOldValue(@NonNull String errorMessage, @NonNull TextFormat format) {
    return LintUtils.findSubstring(format.toText(errorMessage), " tag <", ">");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:WrongCaseDetector.java

示例10: getNewValue

import com.android.tools.lint.detector.api.LintUtils; //导入方法依赖的package包/类
/**
 * Given an error message produced by this lint detector for the given issue type,
 * returns the new value to be put into the source code.
 * <p>
 * Intended for IDE quickfix implementations.
 *
 * @param errorMessage the error message associated with the error
 * @param format the format of the error message
 * @return the corresponding new value, or null if not recognized
 */
@Nullable
public static String getNewValue(@NonNull String errorMessage, @NonNull TextFormat format) {
    return LintUtils.findSubstring(format.toText(errorMessage), " should be <", ">");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:WrongCaseDetector.java


注:本文中的com.android.tools.lint.detector.api.LintUtils.findSubstring方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。