NOVA-Team / NOVA-Monorepo

The core API of the NOVA voxel game modding system
https://nova-team.github.io
GNU Lesser General Public License v3.0
66 stars 23 forks source link

Allow Factory to use dependency injection for instantiating objects #269

Closed ExE-Boss closed 7 years ago

ExE-Boss commented 7 years ago

This PR implements nova.internal.core.InjectionUtil to allow usage of dependency injection when passing a class instead of a supplier to a Factory constructor. This also fixes the dependency injection issue from #261, which prevented the usage of dependency injection back then. InjectionUtil is now also used by nova.internal.core.launch.ModLoader

codecov-io commented 7 years ago

Codecov Report

Merging #269 into master will decrease coverage by 0.09%. The diff coverage is 13.13%.

@@             Coverage Diff             @@
##             master     #269     +/-   ##
===========================================
- Coverage     13.35%   13.26%   -0.1%     
- Complexity      679      684      +5     
===========================================
  Files           404      405      +1     
  Lines         12096    12179     +83     
  Branches       1284     1286      +2     
===========================================
  Hits           1615     1615             
- Misses        10382    10464     +82     
- Partials         99      100      +1
Impacted Files Coverage Δ Complexity Δ
...n/java/nova/core/util/registry/FactoryManager.java 100% <ø> (ø) 3 <0> (ø) :x:
src/main/java/nova/core/block/BlockManager.java 87.5% <0%> (-12.5%) 5 <0> (ø)
src/main/java/nova/core/world/WorldManager.java 35.29% <0%> (-4.71%) 1 <0> (ø)
src/main/java/nova/core/entity/EntityFactory.java 35.71% <0%> (-26.79%) 2 <0> (ø)
src/main/java/nova/core/block/BlockFactory.java 28.94% <0%> (-32.17%) 3 <0> (ø)
src/main/java/nova/core/util/registry/Factory.java 42.85% <0%> (-47.15%) 4 <0> (ø)
src/main/java/nova/core/item/ItemManager.java 56.52% <0%> (-5.39%) 4 <0> (ø)
src/main/java/nova/core/world/WorldFactory.java 0% <0%> (ø) 0 <0> (ø) :x:
...n/java/nova/core/component/fluid/FluidFactory.java 35.71% <0%> (-26.79%) 2 <0> (ø)
src/main/java/nova/core/entity/EntityManager.java 80% <0%> (-20%) 3 <0> (ø)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update cf48a54...1ce0043. Read the comment docs.

ExE-Boss commented 7 years ago

Squashed and rebased to master