/** * Gets the super class of this class. * * @return the super class of this class */ public final ProxyType getSuperclass() throws IOException, SDWPException { Klass superClass = klass.getSuperclass(); // the "-bytecode-" class actually inherits from INT, but don't tell jdwp that! if (superClass != null && !superClass.isPrimitive()) { return ptm.lookup(superClass, true); } return null; }
/** * Returns interfaces directly implemented by this type. * * @return a List of the interfaces directly implemented by this type */ @SuppressWarnings("unchecked") public List getInterfaces() throws IOException, SDWPException { Klass[] interfaces = klass.getInterfaces(); List list = new ArrayList(interfaces.length); for (int i = 0; i != interfaces.length; ++i) { list.add(ptm.lookup(interfaces[i], true)); } return list; }
/** * Gets the field corresponding to a given field ID. * * <p>Note that the field may be defined in <code>this</code> class, or in a superclass or * implemented interface class. * * @param id the identifier of the field to retrieve * @return the ProxyField object corresponding to <code>id</code> or null * @throws SDWPException if the FieldID <code>id</code> is not defined in <code>this</code> class * or in a superclass or implemented interface class. */ public ProxyField getField(FieldID id) throws IOException, SDWPException { if (id.definingClass.equals(this.id)) { for (Iterator iterator = getFields().iterator(); iterator.hasNext(); ) { ProxyField field = (ProxyField) iterator.next(); if (field.getID().equals(id)) { return field; } } throw new SDWPException(JDWP.Error_INVALID_FIELDID, id + " is not a field of " + this); } ProxyType definingProxyType = ptm.lookup(id.definingClass, true); // make sure that "this" class is a suptype or interface of the field's defining class if (!definingProxyType.getKlass().isAssignableFrom(this.getKlass())) { throw new SDWPException(JDWP.Error_INVALID_FIELDID, id + " is not a field of " + this); } return definingProxyType.getField(id); }