Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 386068 - @Replace annotation for replacing scout objects defined in super classes
Summary: @Replace annotation for replacing scout objects defined in super classes
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Scout (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 388559
Blocks: 384479
  Show dependency tree
 
Reported: 2012-07-26 12:43 EDT by Andi Bur CLA
Modified: 2021-08-19 11:18 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andi Bur CLA 2012-07-26 12:43:11 EDT
Currently it is tedious to replace scout model objects configured in super classes by sub classes. Just extending the super class does not replace its instance (but inherits all its properties). While this is desired in rare situations, it is more common to replace overridden classes by their subclasses.

A new annotation @Replace should control and simplify the process of replacement:
o Subclasses without the @Replace annotation are simply added as additional instance
o Subclasses with the @Replace annotation replace the direct super class
o Subclasses with the @Replace(value=Foo.class) annotation replace the first class found, that is assignable to the given class.

Example:

Current style
public class MyTable extends AbstractTable {
  public class MyColumn extends AbstractStringColumn {
  }
}

public class MyTableEx extends MyTable {
  @Override
  protected void injectColumnsInternal(List<IColumn<?>> columnList) {
    ExtensionClientUtility.removeByType(columnList, MyColumn.class);
  }
  public class MyColumnEx extends MyColumn {
  }
}

Using the new @Replace annotation
public class MyTable extends AbstractExtensibleTable {
  public class MyColumn extends AbstractStringColumn {
  }
}

public class MyTableEx extends MyTable {
  @Replace
  public class MyColumnEx extends MyColumn {
  }
}
Comment 1 Andi Bur CLA 2012-07-26 13:26:42 EDT
added annotation as suggested to scout client extension layer.
committed on scout trunk (3.9.0)
Comment 2 Matthias Zimmermann CLA 2013-07-08 17:25:48 EDT
Bug closed, shipped with 3.9.0 (Kepler)