本文整理汇总了Java中com.sun.jdi.ReferenceType.name方法的典型用法代码示例。如果您正苦于以下问题:Java ReferenceType.name方法的具体用法?Java ReferenceType.name怎么用?Java ReferenceType.name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jdi.ReferenceType
的用法示例。
在下文中一共展示了ReferenceType.name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGenericName
import com.sun.jdi.ReferenceType; //导入方法依赖的package包/类
private String getGenericName(ReferenceType type) throws DebugException {
if (type instanceof ArrayType) {
try {
Type componentType;
componentType = ((ArrayType) type).componentType();
if (componentType instanceof ReferenceType) {
return getGenericName((ReferenceType) componentType) + "[]"; //$NON-NLS-1$
}
return type.name();
} catch (ClassNotLoadedException e) {
// we cannot create the generic name using the component type,
// just try to create one with the information
}
}
String signature = type.signature();
StringBuffer res = new StringBuffer(getTypeName(signature));
String genericSignature = type.genericSignature();
if (genericSignature != null) {
String[] typeParameters = Signature.getTypeParameters(genericSignature);
if (typeParameters.length > 0) {
res.append('<').append(Signature.getTypeVariable(typeParameters[0]));
for (int i = 1; i < typeParameters.length; i++) {
res.append(',').append(Signature.getTypeVariable(typeParameters[i]));
}
res.append('>');
}
}
return res.toString();
}
示例2: perform
import com.sun.jdi.ReferenceType; //导入方法依赖的package包/类
@Override
public void perform(String[] argv, Context ctx) {
for (ReferenceType type : ctx.getClasses()) {
String name = type.name();
if (argv.length > 0) {
if (name.contains(argv[0]))
System.out.println(name);
} else {
System.out.println(name);
}
}
}
示例3: unbox
import com.sun.jdi.ReferenceType; //导入方法依赖的package包/类
public static Value unbox(ObjectReference val, PrimitiveType type,
ThreadReference thread,
EvaluationContext context) throws InvalidTypeException,
ClassNotLoadedException,
IncompatibleThreadStateException,
InvocationException {
ReferenceType rt = val.referenceType();
String classType = rt.name();
PrimitiveValue pv;
if (classType.equals("java.lang.Boolean")) {
pv = invokeUnboxingMethod(val, "booleanValue", thread, context);
} else if (classType.equals("java.lang.Byte")) {
pv = invokeUnboxingMethod(val, "byteValue", thread, context);
} else if (classType.equals("java.lang.Character")) {
pv = invokeUnboxingMethod(val, "charValue", thread, context);
} else if (classType.equals("java.lang.Short")) {
pv = invokeUnboxingMethod(val, "shortValue", thread, context);
} else if (classType.equals("java.lang.Integer")) {
pv = invokeUnboxingMethod(val, "intValue", thread, context);
} else if (classType.equals("java.lang.Long")) {
pv = invokeUnboxingMethod(val, "longValue", thread, context);
} else if (classType.equals("java.lang.Float")) {
pv = invokeUnboxingMethod(val, "floatValue", thread, context);
} else if (classType.equals("java.lang.Double")) {
pv = invokeUnboxingMethod(val, "doubleValue", thread, context);
//throw new RuntimeException("Invalid type while unboxing: " + type.signature()); // never happens
} else {
return val;
}
VirtualMachine vm = pv.virtualMachine();
if (type instanceof BooleanType && !(pv instanceof BooleanValue)) {
return vm.mirrorOf(pv.booleanValue());
}
if (type instanceof ByteType && !(pv instanceof ByteValue)) {
return vm.mirrorOf(pv.byteValue());
}
if (type instanceof CharType && !(pv instanceof CharValue)) {
return vm.mirrorOf(pv.charValue());
}
if (type instanceof ShortType && !(pv instanceof ShortValue)) {
return vm.mirrorOf(pv.shortValue());
}
if (type instanceof IntegerType && !(pv instanceof IntegerValue)) {
return vm.mirrorOf(pv.intValue());
}
if (type instanceof LongType && !(pv instanceof LongValue)) {
return vm.mirrorOf(pv.longValue());
}
if (type instanceof FloatType && !(pv instanceof FloatValue)) {
return vm.mirrorOf(pv.floatValue());
}
if (type instanceof DoubleType && !(pv instanceof DoubleValue)) {
return vm.mirrorOf(pv.doubleValue());
}
return pv;
}