Exemplo n.º 1
0
 /* Compare based on class signature */
 public int compareTo(Object o) {
   if (o == this) {
     return 0;
   }
   if (!(o instanceof ProxyType)) {
     return -1;
   }
   ProxyType other = (ProxyType) o;
   return getSignature().compareTo(other.getSignature());
 }
Exemplo n.º 2
0
  /**
   * 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);
  }