本文整理汇总了Java中com.sun.jdi.ReferenceType.fieldByName方法的典型用法代码示例。如果您正苦于以下问题:Java ReferenceType.fieldByName方法的具体用法?Java ReferenceType.fieldByName怎么用?Java ReferenceType.fieldByName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.jdi.ReferenceType
的用法示例。
在下文中一共展示了ReferenceType.fieldByName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stopDebuggerRemoteService
import com.sun.jdi.ReferenceType; //导入方法依赖的package包/类
private void stopDebuggerRemoteService(JPDADebugger d) {
ClassObjectReference serviceClass = RemoteServices.getServiceClass(d, RemoteServices.ServiceType.AWT);
if (serviceClass == null) {
return ;
}
try {
ReferenceType serviceType = serviceClass.reflectedType();
Field awtAccessLoop = serviceType.fieldByName("awtAccessLoop"); // NOI18N
if (awtAccessLoop != null) {
((ClassType) serviceType).setValue(awtAccessLoop, serviceClass.virtualMachine().mirrorOf(false));
}
serviceClass.enableCollection();
} catch (VMDisconnectedException vdex) {
// Ignore
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
}
}
示例2: fieldByName
import com.sun.jdi.ReferenceType; //导入方法依赖的package包/类
@Override
public Field fieldByName(String string) {
for (ReferenceType t : types) {
Field field = t.fieldByName(string);
if (field != null) {
return field;
}
}
return null;
}
示例3: addFieldWatch
import com.sun.jdi.ReferenceType; //导入方法依赖的package包/类
private static void addFieldWatch(VirtualMachine vm,
ReferenceType refType) {
EventRequestManager erm = vm.eventRequestManager();
Field field = refType.fieldByName(FIELD_NAME);
ModificationWatchpointRequest modificationWatchpointRequest = erm
.createModificationWatchpointRequest(field);
modificationWatchpointRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
modificationWatchpointRequest.setEnabled(true);
}
示例4: handleSetValueForStackFrame
import com.sun.jdi.ReferenceType; //导入方法依赖的package包/类
private Value handleSetValueForStackFrame(String name, String belongToClass, String valueString,
boolean showStaticVariables, StackFrame container, Map<String, Object> options)
throws AbsentInformationException, InvalidTypeException, ClassNotLoadedException {
Value newValue;
if (name.equals("this")) {
throw new UnsupportedOperationException("SetVariableRequest: 'This' variable cannot be changed.");
}
LocalVariable variable = container.visibleVariableByName(name);
if (StringUtils.isBlank(belongToClass) && variable != null) {
newValue = this.setFrameValue(container, variable, valueString, options);
} else {
if (showStaticVariables && container.location().method().isStatic()) {
ReferenceType type = container.location().declaringType();
if (StringUtils.isBlank(belongToClass)) {
Field field = type.fieldByName(name);
newValue = setStaticFieldValue(type, field, name, valueString, options);
} else {
newValue = setFieldValueWithConflict(null, type.allFields(), name, belongToClass,
valueString, options);
}
} else {
throw new UnsupportedOperationException(
String.format("SetVariableRequest: Variable %s cannot be found.", name));
}
}
return newValue;
}
示例5: process
import com.sun.jdi.ReferenceType; //导入方法依赖的package包/类
public void process(String accessControlClass, int lineNum) throws Exception {
EventRequestManager erm = vm.eventRequestManager();
Optional<ReferenceType> classRef = getFirstClassReference(accessControlClass);
if (!classRef.isPresent()) {
throw new ClassNotFoundException(String.format("Class %s not found", accessControlClass));
}
ReferenceType accRef = classRef.get();
Field contextField = accRef.fieldByName("context");
Location location = accRef.locationsOfLine(lineNum).get(0);
BreakpointRequest br = erm.createBreakpointRequest(location);
loop(br, contextField);
}