本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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 @", "/");
}
示例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 \"", "\"");
}
示例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 \"", "\"");
}
示例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 <", ">");
}
示例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 <", ">");
}