Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factory code generator should strip the generic part of dependencies #117

Closed
stephanenicolas opened this issue Jul 5, 2016 · 1 comment

Comments

@stephanenicolas
Copy link
Owner

In a class using a dependency that is generics such as:

public class DaoGoodsBrowseByCategory extends GrouponBaseDao<GoodsBrowseByCategory> {

    @Inject
    public DaoGoodsBrowseByCategory(ConnectionSource connectionSource, DatabaseTableConfig tableConfig) throws SQLException {
        super(connectionSource, tableConfig);
    }

where DatabaseTableConfig is

public class DatabaseTableConfig<T>

TP then generates the following Factory

public final class DaoGoodsBrowseByCategory$$Factory implements Factory<DaoGoodsBrowseByCategory> {
  @Override
  public DaoGoodsBrowseByCategory createInstance(Scope scope) {
    scope = getTargetScope(scope);
    ConnectionSource param1 = scope.getInstance(ConnectionSource.class);
    DatabaseTableConfig<T> param2 = scope.getInstance(DatabaseTableConfig.class);
    DaoGoodsBrowseByCategory daoGoodsBrowseByCategory = new DaoGoodsBrowseByCategory(param1, param2);
    return daoGoodsBrowseByCategory;
  }

We should just strip off the <T> of DatabaseTableConfig<T> param2 = scope.getInstance(DatabaseTableConfig.class);

@stephanenicolas stephanenicolas added this to the 1.0.0 milestone Sep 29, 2016
stephanenicolas added a commit that referenced this issue Oct 2, 2016
stephanenicolas added a commit that referenced this issue Oct 3, 2016
stephanenicolas added a commit that referenced this issue Oct 3, 2016
stephanenicolas added a commit that referenced this issue Oct 3, 2016
solves issue #117: Make generic usage more robust with Lazy / Provider
@stephanenicolas
Copy link
Owner Author

This will be released in 1.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant