Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
public class MyAction implements IAction { \\
public void setAttachments(int index, Object o)
{     //do something   }\\
public Object getAttachments()\\
 { //will not be called }\\
public void execute() throws Exception {} \\
}

Alternatively, you can specify a getter method that returns a reference to the array to which the attachment object will be added, e.g.

Code Block
public class MyAction implements IAction { \\
private List<Object> attachments = new ArrayList<Object>(); \\
public List<Object> getAttachments()
{     return attachments;   }\\
public void execute() throws Exception {} \\
}

These two behaviors are employed by BeanUtils to implement what they called indexed properties. In summary,

...