本文整理汇总了Java中spoon.reflect.reference.CtTypeReference.isSubtypeOf方法的典型用法代码示例。如果您正苦于以下问题:Java CtTypeReference.isSubtypeOf方法的具体用法?Java CtTypeReference.isSubtypeOf怎么用?Java CtTypeReference.isSubtypeOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spoon.reflect.reference.CtTypeReference
的用法示例。
在下文中一共展示了CtTypeReference.isSubtypeOf方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clashes
import spoon.reflect.reference.CtTypeReference; //导入方法依赖的package包/类
public static boolean clashes(CtMethod<?> a, CtMethod<?> b) {
if (!a.getSimpleName().equals(b.getSimpleName()))
return false;
List<CtParameter<?>> aParams = a.getParameters();
List<CtParameter<?>> bParams = b.getParameters();
if (aParams.size() != bParams.size())
return false;
for (int i = 0; i < aParams.size(); i++) {
CtTypeReference<?> aParam = aParams.get(i).getType();
CtTypeReference<?> bParam = bParams.get(i).getType();
if (aParam.isSubtypeOf(bParam))
continue;
if (bParam.isSubtypeOf(aParam))
continue;
if (isNumericPrimitive(aParam) && isNumericPrimitive(bParam))
continue;
// TODO update when unbox() bug fixed in Spoon
return false;
}
return true;
}
示例2: isComponentRef
import spoon.reflect.reference.CtTypeReference; //导入方法依赖的package包/类
public boolean isComponentRef(CtExpression<?> expr) {
// CtTypeReference type2 = expr.getType();
CtTypeReference<?> typeRef = getExprReference(expr);
// CtTypeReference<?> type = getTypeReference(typeRef);//Check if this
// will be needed
if (typeRef != null) {
if (typeRef.isSubtypeOf(awtComponentRef)) {
return true;
} else if (typeRef.isSubtypeOf(swingComponentRef)) {
return true;
}
}
return false;
}
示例3: process
import spoon.reflect.reference.CtTypeReference; //导入方法依赖的package包/类
@Override
public void process(CtTypedElement element) {
List<CtTypeReference<?>> listDependencies = getDependencies(element);
CtTypeReference<Exception> exception = getFactory().Class().createReference(Exception.class);
for (CtTypeReference<?> ctTypeReference : listDependencies) {
if (ctTypeReference == null) {
continue;
}
if (ctTypeReference.isPrimitive()) {
continue;
}
if (ctTypeReference.toString().equals("<nulltype>")) {
continue;
}
if (exception.isSubtypeOf(ctTypeReference)) {
continue;
}
if (classes.contains(ctTypeReference.getQualifiedName())) {
return;
}
if (classes.add(ctTypeReference.getQualifiedName())) {
logger.debug("[class] " + ctTypeReference.getQualifiedName());
}
}
}
示例4: registerEvent
import spoon.reflect.reference.CtTypeReference; //导入方法依赖的package包/类
private void registerEvent(CtMethod<?> method) {
List<CtParameter<?>> params = method.getParameters();
for (CtParameter<?> param : params) {
CtTypeReference<?> type = param.getType();
if (type.isSubtypeOf(eventRef))
events.add(type);
}
}
示例5: isComponent
import spoon.reflect.reference.CtTypeReference; //导入方法依赖的package包/类
public boolean isComponent(CtTypeReference<?> comp) {
CtTypeReference<?> type = getTypeReference(comp);
if (type != null) {
if (type.isSubtypeOf(awtComponentRef)) {
return true;
} else if (type.isSubtypeOf(swingComponentRef)) {
return true;
}
}
return false;
}
示例6: isEventRef
import spoon.reflect.reference.CtTypeReference; //导入方法依赖的package包/类
public boolean isEventRef(CtTypeReference<?> event) {
CtTypeReference<?> type = getTypeReference(event);
if (type != null) {
if (type.isSubtypeOf(eventRef)) {
return true;
} else if (type.isSubtypeOf(eventListenerRef)) {
return true;
}
}
return false;
}
示例7: isSubclassOf
import spoon.reflect.reference.CtTypeReference; //导入方法依赖的package包/类
public static boolean isSubclassOf(CtTypeReference<?> superType, CtTypeReference<?> type) {
return superType.isSubtypeOf(type);
}