本文整理汇总了Java中com.android.tools.lint.client.api.JavaEvaluator.extendsClass方法的典型用法代码示例。如果您正苦于以下问题:Java JavaEvaluator.extendsClass方法的具体用法?Java JavaEvaluator.extendsClass怎么用?Java JavaEvaluator.extendsClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.android.tools.lint.client.api.JavaEvaluator
的用法示例。
在下文中一共展示了JavaEvaluator.extendsClass方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkClass
import com.android.tools.lint.client.api.JavaEvaluator; //导入方法依赖的package包/类
@Override
public void checkClass(JavaContext context, PsiClass node) {
super.checkClass(context, node);
JavaEvaluator evaluator = context.getEvaluator();
if (evaluator.isAbstract(node)) {
return;
}
boolean isFragmentPagerAdapter = evaluator.extendsClass(node, CLASS_FRAGMENT_PAGER_ADAPTER, false);
if (isFragmentPagerAdapter) return;
boolean isFragmentStatePagerAdapter = evaluator.extendsClass(node, CLASS_FRAGMENT_STATE_PAGER_ADAPTER, false);
if (isFragmentStatePagerAdapter) return;
boolean supportAutoPoint = evaluator.extendsClass(node, CLASS_AUTOPOINT_PAGER_ADAPTER, false);
if (!supportAutoPoint) {
context.report(ISSUE_PAGER_ADAPTER, node, context.getLocation(node),
"Pager Adapter 必须实现DDPagerAdapter,否则不支持自动打点 class:" + node.getName());
}
}
示例2: checkClass
import com.android.tools.lint.client.api.JavaEvaluator; //导入方法依赖的package包/类
@Override
public void checkClass(JavaContext context, PsiClass node) {
super.checkClass(context, node);
JavaEvaluator evaluator = context.getEvaluator();
if (evaluator.isAbstract(node)) {
return;
}
boolean supportAutoPoint = evaluator.extendsClass(node, CLASS_AUTO_POINT_ALERT_DIALOG, false);
if (!supportAutoPoint) {
context.report(ISSUE_ALERT_DIALOG, node, context.getLocation(node),
String.format("%s do not support auto point,should extends DDV7AlertDialog", node.toString()));
}
}
示例3: checkClass
import com.android.tools.lint.client.api.JavaEvaluator; //导入方法依赖的package包/类
@Override
public void checkClass(JavaContext context, PsiClass node) {
super.checkClass(context, node);
JavaEvaluator evaluator = context.getEvaluator();
if (evaluator.isAbstract(node)) {
return;
}
boolean supportAutoPoint = evaluator.extendsClass(node, CLASS_AUTO_POINT_EXPANDABLE_LIST_VIEW, false);
if (!supportAutoPoint) {
context.report(ISSUE_EXPANDABLE_LIST_VIEW, node, context.getLocation(node),
String.format("%s do not support auto point,should extends DDExpandableListView", node.toString()));
}
}
示例4: checkClass
import com.android.tools.lint.client.api.JavaEvaluator; //导入方法依赖的package包/类
@Override
public void checkClass(JavaContext context, PsiClass node) {
super.checkClass(context, node);
JavaEvaluator evaluator = context.getEvaluator();
if (evaluator.isAbstract(node)) {
return;
}
boolean supportAutoPoint = evaluator.extendsClass(node, CLASS_AUTO_POINT_POP_WINDOW, false);
if (!supportAutoPoint) {
context.report(ISSUE_POP_WINDOW, node, context.getLocation(node),
String.format("%s do not support auto point,should extends DDPopupWindow", node.toString()));
}
}
示例5: checkClass
import com.android.tools.lint.client.api.JavaEvaluator; //导入方法依赖的package包/类
@Override
public void checkClass(JavaContext context, PsiClass node) {
super.checkClass(context, node);
JavaEvaluator evaluator = context.getEvaluator();
if (evaluator.isAbstract(node)) {
return;
}
boolean supportAutoPoint = evaluator.extendsClass(node, CLASS_AUTO_POINT_GRID_VIEW, false);
if (!supportAutoPoint) {
context.report(ISSUE_GRID_VIEW, node, context.getLocation(node),
String.format("%s do not support auto point,should extends DDGridView", node.toString()));
}
}
示例6: checkClass
import com.android.tools.lint.client.api.JavaEvaluator; //导入方法依赖的package包/类
@Override
public void checkClass(JavaContext context, PsiClass node) {
super.checkClass(context, node);
JavaEvaluator evaluator = context.getEvaluator();
if (evaluator.isAbstract(node)) {
return;
}
boolean supportAutoPoint = evaluator.extendsClass(node, CLASS_AUTO_POINT_ALERT_DIALOG, false);
if (!supportAutoPoint) {
context.report(ISSUE_ALERT_DIALOG, node, context.getLocation(node),
String.format("%s do not support auto point,should extends DDAlertDialog", node.toString()));
}
}
示例7: checkClass
import com.android.tools.lint.client.api.JavaEvaluator; //导入方法依赖的package包/类
@Override
public void checkClass(JavaContext context, PsiClass node) {
super.checkClass(context, node);
JavaEvaluator evaluator = context.getEvaluator();
if (evaluator.isAbstract(node)) {
return;
}
boolean autopoint_dialog = evaluator.extendsClass(node, CLASS_AUTO_POINT_DIALOG, false);
boolean alert_dialog = evaluator.extendsClass(node, CLASS_ALERT_DIALOG, false);
boolean alert_v7_dialog = evaluator.extendsClass(node, CLASS_ALERT_V7_DIALOG, false);
if (!alert_v7_dialog && !alert_dialog && !autopoint_dialog) {
context.report(ISSUE_DIALOG, node, context.getLocation(node),
String.format("%s do not support auto point,should extends DDDialog", node.toString()));
}
}
示例8: checkClass
import com.android.tools.lint.client.api.JavaEvaluator; //导入方法依赖的package包/类
@Override
public void checkClass(JavaContext context, PsiClass node) {
super.checkClass(context, node);
JavaEvaluator evaluator = context.getEvaluator();
if (evaluator.isAbstract(node)) {
return;
}
boolean shouldIgnore = evaluator.extendsClass(node, CLASS_EXPANDABLE_LIST_VIEW, false);
if (shouldIgnore) return;
boolean supportAutoPoint = evaluator.extendsClass(node, CLASS_AUTO_POINT_LIST_VIEW, false);
if (!supportAutoPoint) {
context.report(ISSUE_LIST_VIEW, node, context.getLocation(node),
String.format("%s do not support auto point,should extends DDListView", node.toString()));
}
}
示例9: checkClass
import com.android.tools.lint.client.api.JavaEvaluator; //导入方法依赖的package包/类
@Override
public void checkClass(JavaContext context, PsiClass node) {
super.checkClass(context, node);
JavaEvaluator evaluator = context.getEvaluator();
if (evaluator.isAbstract(node)) {
return;
}
boolean supportAutoPoint = evaluator.extendsClass(node, CLASS_AUTOPOINT_RECYCLERVIEW_ADAPTER, false);
if (!supportAutoPoint) {
context.report(ISSUE_RECYCLER_ADAPTER, node, context.getLocation(node),
"Recycler Adapter 必须实现DDRecyclerAdapter,否则不支持自动打点 class:" + node.getName());
}
}
示例10: visitNewExpression
import com.android.tools.lint.client.api.JavaEvaluator; //导入方法依赖的package包/类
@Override
public void visitNewExpression(PsiNewExpression expression) {
super.visitNewExpression(expression);
PsiMethod constructor = expression.resolveConstructor();
if (constructor == null) return;
JavaEvaluator evaluator = mContext.getEvaluator();
PsiClass cls = constructor.getContainingClass();
boolean isView = evaluator.extendsClass(cls, CLASS_VIEW, true);
if (!isView) return;
Location location = this.mContext.getLocation(expression);
PsiElement psiElement = expression.getParent();
//创建的变量没有赋值给本地变量,无法指定注解
if (!(psiElement instanceof PsiLocalVariable)) {
this.mContext.report(DynamicNewViewDetector.ISSUE, expression, location, "检测到动态创建view操作,new 操作的结果需要赋值给本地变量");
return;
}
PsiLocalVariable localVariable = (PsiLocalVariable) psiElement;
PsiModifierList modifierList = localVariable.getModifierList();
if (modifierList == null) {
this.mContext.report(DynamicNewViewDetector.ISSUE, expression, location, "检测到动态创建view操作,确认是否为view指定了唯一标识");
return;
}
PsiAnnotation[] annotations = modifierList.getAnnotations();
for (PsiAnnotation annotation : annotations) {
String fullName = annotation.getQualifiedName();
if (IDENTIFIER_ANNOTATION.equals(fullName)) {
return;
}
}
this.mContext.report(DynamicNewViewDetector.ISSUE, expression, location, "检测到动态创建view操作,确认是否为view指定了唯一标识");
}
示例11: isApplicationClassCall
import com.android.tools.lint.client.api.JavaEvaluator; //导入方法依赖的package包/类
private boolean isApplicationClassCall(JavaContext context, PsiElement call) {
JavaEvaluator evaluator = context.getEvaluator();
PsiClass cls = PsiTreeUtil.getParentOfType(call, PsiClass.class, true);
return cls != null && evaluator.extendsClass(cls, "android.app.Application", false);
}