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

Implement Injector #705

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Implement Injector #705

wants to merge 2 commits into from

Conversation

Dimagaa
Copy link

@Dimagaa Dimagaa commented Aug 7, 2023

Update Component and Injector annotation Retention policy and set Target element type

Update Component and Injector annotation Retention policy and set Target element type
Comment on lines 19 to 24
private Injector() {
instances = new HashMap<>();
implementations = Map.of(FileReaderService.class, FileReaderServiceImpl.class,
ProductParser.class, ProductParserImpl.class,
ProductService.class, ProductServiceImpl.class);
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundant

Comment on lines 27 to 29
if (injector == null) {
injector = new Injector();
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundant

Comment on lines +41 to +44
if (!componentClass.isAnnotationPresent(Component.class)) {
throw new RuntimeException("Can't get instance of non-component class "
+ interfaceClazz.getName());
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move it to separate method

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

Successfully merging this pull request may close these issues.

4 participants