本文整理汇总了Java中com.squareup.haha.perflib.Instance.getClassObj方法的典型用法代码示例。如果您正苦于以下问题:Java Instance.getClassObj方法的具体用法?Java Instance.getClassObj怎么用?Java Instance.getClassObj使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.squareup.haha.perflib.Instance
的用法示例。
在下文中一共展示了Instance.getClassObj方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rootSuperClassAlwaysIgnored
import com.squareup.haha.perflib.Instance; //导入方法依赖的package包/类
private Exclusion rootSuperClassAlwaysIgnored(Instance child) {
if (child == null) {
return null;
}
Exclusion matchingParams = null;
ClassObj superClassObj = child.getClassObj();
while (superClassObj != null) {
Exclusion params = excludedRefs.rootClassNames.get(superClassObj.getClassName());
if (params != null) {
// true overrides null or false.
if (matchingParams == null || !matchingParams.alwaysExclude) {
matchingParams = params;
}
}
superClassObj = superClassObj.getSuperClassObj();
}
return matchingParams;
}
示例2: isString
import com.squareup.haha.perflib.Instance; //导入方法依赖的package包/类
private boolean isString(Instance instance) {
return instance.getClassObj() != null && instance.getClassObj()
.getClassName()
.equals(String.class.getName());
}
示例3: buildLeakElement
import com.squareup.haha.perflib.Instance; //导入方法依赖的package包/类
private LeakTraceElement buildLeakElement(LeakNode node) {
if (node.parent == null) {
// Ignore any root node.
return null;
}
Instance holder = node.parent.instance;
if (holder instanceof RootObj) {
return null;
}
LeakTraceElement.Type type = node.referenceType;
String referenceName = node.referenceName;
LeakTraceElement.Holder holderType;
String className;
String extra = null;
List<String> fields = describeFields(holder);
className = getClassName(holder);
if (holder instanceof ClassObj) {
holderType = CLASS;
} else if (holder instanceof ArrayInstance) {
holderType = ARRAY;
} else {
ClassObj classObj = holder.getClassObj();
if (extendsThread(classObj)) {
holderType = THREAD;
String threadName = threadName(holder);
extra = "(named '" + threadName + "')";
} else if (className.matches(ANONYMOUS_CLASS_NAME_PATTERN)) {
String parentClassName = classObj.getSuperClassObj().getClassName();
if (Object.class.getName().equals(parentClassName)) {
holderType = OBJECT;
try {
// This is an anonymous class implementing an interface. The API does not give access
// to the interfaces implemented by the class. We check if it's in the class path and
// use that instead.
Class<?> actualClass = Class.forName(classObj.getClassName());
Class<?>[] interfaces = actualClass.getInterfaces();
if (interfaces.length > 0) {
Class<?> implementedInterface = interfaces[0];
extra = "(anonymous implementation of " + implementedInterface.getName() + ")";
} else {
extra = "(anonymous subclass of java.lang.Object)";
}
} catch (ClassNotFoundException ignored) {
}
} else {
holderType = OBJECT;
// Makes it easier to figure out which anonymous class we're looking at.
extra = "(anonymous subclass of " + parentClassName + ")";
}
} else {
holderType = OBJECT;
}
}
return new LeakTraceElement(referenceName, type, holderType, className, extra, node.exclusion,
fields);
}