Reuse of a Table Builder Class
An API defined in one builder could be reused while writing a new builder. In general, it is preferable to keep the needed builder as an instance field of the table implementation, rather than extending the other builder. This follows the general rule of thumb of favoring composition over inheritance. If reuse of a a config builder is intended, it should be ensured to set the component config factory on it.
An example:
@ComponentBuilder("my.builder")
public class MyBuilder extends AbstractComponentBuilder {
private final OtherBuilder otherBuilder = new OtherBuilder ();
@Override
public ComponentConfig buildComponentConfig(ComponentParams params) throws WTException{
…
}
@Override
public void setComponentConfigFactory(ComponentConfigFactory configFactory) {
super.setComponentConfigFactory(configFactory);
otherBuilder.setComponentConfigFactory(configFactory);
}
}