0 Replies Latest reply on Jan 16, 2009 2:35 AM by 843807

    How do I get the javabeans Introspector to ignore an interface?

      I've been struggling with this problem for the last couple days. I have the following code:

      public interface Prunable {
      public Object getId();
      public boolean isPruned();
      public void setPruned(boolean pruned);

      public class SomeEntity implements Prunable {
      Long id;
      boolean pruned;
      public Long getId() { return id }
      public void setId(Long id) { this.id = id; }
      public boolean isPruned() { return pruned; }
      public void setPruned(boolean pruned) { this.pruned = pruned; }
      // Other attrubutes with getters and setters....

      The problem is that when the java.beans.Introspector is used to look at my class (like BlazeDS), the id attribute shows up as a read-only property. I tried adding a setter to the interface. The property then showed up as read-write, but with a type of Object, which is still wrong. What I need to do is somehow get the Introspector to ignore the methods in the interface so that only those in the class are used. I don't want a BeanInfo class for the Entity itself, because the Prunable interface is in a jar others use, and I don't want users of my jar to have to know about BeanInfo classes.

      Can anyone point me in the right direction?