Skip to content

Comments

container#96

Open
leonshting wants to merge 21 commits intoarhangeldim:masterfrom
leonshting:leonshting-container
Open

container#96
leonshting wants to merge 21 commits intoarhangeldim:masterfrom
leonshting:leonshting-container

Conversation

@leonshting
Copy link

container!

Map<String, Object> objByClassName;
Map<String, Bean> beanByName;
Map<String, Bean> beanByClassName;
Stack<String> beanStack;
Copy link
Collaborator

Choose a reason for hiding this comment

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

прописывайте модификаторы доступа

mapFromNode(currentNode.path("properties"))));
}
return beanList;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

а какой смысл выносить в отдельный метод? используется в одном месте

Copy link
Collaborator

Choose a reason for hiding this comment

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

А, ну если как разделение на логические блоки. Ну да, можно

if (entry.getValue().getType() == ValueType.VAL &&
method.getName().toLowerCase().equals("set".concat(entry.getValue().getName()))) {
method.invoke(toReturn, Converter.convert(method.getParameterTypes()[0].toString(),
entry.getValue().getValue()));
Copy link
Collaborator

Choose a reason for hiding this comment

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

мне кажется, проще было бы формировать сеттер из названия поля объекта и проверять есть ли такой метод у создаваемого объекта

Copy link
Collaborator

Choose a reason for hiding this comment

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

Вообще, в рефлекшене можно выставить значение поля, не перебирая методы
field.set(obj, value)

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.

2 participants