ictvmt / mvp4g

Automatically exported from code.google.com/p/mvp4g
0 stars 0 forks source link

@History annotation propagation #125

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When creating History Converter that extends some abstract HistoryConverter in 
implementation you need to add explicit @History annotation - it's not 
propagated from parent class. For example:

{{{
public class SimpleHistoryConverter<T extends EventBusWithLookup> implements 
HistoryConverter<T> {

    @Override
    public void convertFromToken(String historyName, String param, T eventBus) {
        eventBus.dispatch(historyName);
    }

    public String convertToToken(String name) {
        return "";
    }

    @Override
    public boolean isCrawlable() {
        return true;
    }
}
}}}

Implementation:
{{{
@History(type = History.HistoryConverterType.SIMPLE)
public class Module1HistoryConverter extends 
SimpleHistoryConverter<Module1EventBus> {

}
}}}

It would be handy to put it in parent class:

{{{
@History(type = History.HistoryConverterType.SIMPLE)
public class SimpleHistoryConverter<T extends EventBusWithLookup> implements 
HistoryConverter<T> {

    @Override
    public void convertFromToken(String historyName, String param, T eventBus) {
        eventBus.dispatch(historyName);
    }

    public String convertToToken(String name) {
        return "";
    }

    @Override
    public boolean isCrawlable() {
        return true;
    }
}
}}}

Implementation:
{{{
public class Module1HistoryConverter extends 
SimpleHistoryConverter<Module1EventBus> {

}
}}}

and override it if needed in child class.

Original issue reported on code.google.com by kospiotr on 18 Jun 2013 at 4:38