`

T is part of return and no parameter is needed in method definition

 
阅读更多

Method definition

 

    private <T extends ModelData> ListStore<T> createCommaSeparatedWildcardListStore()

    {

        ListStore<T> store = new CustomFilterListStore<T>();

        store.addFilter(new CommaSeparatedWildcardStoreFilter<T>());

        return store;

}

 

Method usage

 

   this.companiesListStore = createCommaSeparatedWildcardListStore();

   this.accountsListStore = createCommaSeparatedWildcardListStore();

   this.clientRefListStore = createCommaSeparatedWildcardListStore();

   this.currencyListStore = createCommaSeparatedWildcardListStore();

   this.typeListStore = createCommaSeparatedWildcardListStore();

 

Variable declaration

 

    private final ListStore<IdAndName> companiesListStore;

    private final ListStore<IdAndName> accountsListStore;

    private final ListStore<SimpleComboValue<String>> clientRefListStore;

    private final ListStore<IdAndName> currencyListStore;

    private final ListStore<SimpleComboValue<String>> typeListStore;

    private final ListStore<MarginCallDto> marginCallListStore;

 

Summary

 

The interesting part of this method is, there is no parameters defined in this method.

The method will decide the type T during compilation time based the variable it will return to.

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics