I added a property (using the BeanInfo Editor) of the same type as my bean, and the bean hangs when I use it in Visual Composition. Why?

Scott Stanchfield

When you add any properties that are of an Object type, VAJ creates a variable definition like

  private fieldUncle = new Monkey();

The problem with this is that it goes in a class like

  public class Monkey {
    private fieldUncle = new Monkey();

    public Monkey getUncle() {return fieldUncle;}
    public void setUncle(Monkey newUncle) {
      fieldUncle = newUncle;
    }
  }

which is a tad problematic.

The solution is to simply remove the "new Monkey()" from the variable definition, leaving

  public class Monkey {
    private fieldMonkey;

    public Monkey getUncle() {return fieldUncle;}
    public void setUncle(Monkey newUncle) {
      fieldUncle = newUncle;
    }
  }
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact