Skip to content

Comments

Lesina container#109

Open
lesina wants to merge 16 commits intoarhangeldim:masterfrom
lesina:lesina-container
Open

Lesina container#109
lesina wants to merge 16 commits intoarhangeldim:masterfrom
lesina:lesina-container

Conversation

@lesina
Copy link

@lesina lesina commented Nov 3, 2016

No description provided.

Bean bean = findBean(id);

if (bean == null) {
throw new InvalidConfigurationException("invalid id");
Copy link
Owner

Choose a reason for hiding this comment

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

можно null вернуть?

Copy link
Author

Choose a reason for hiding this comment

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

можно и null возвращать. это будет даже правильнее. сейчас поправлю

}
field.setAccessible(true);
field.set(object, getById(bean.getProperties().get(property).getValue()));
field.setAccessible(false);
Copy link
Owner

Choose a reason for hiding this comment

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

не обязательно выставлять false, это же касается только данного инстанса field

if (property.equals(field.getName())) {
if (bean.getProperties().get(property).getType() == ValueType.VAL) {
field.setAccessible(true);
field.set(object, Integer.parseInt(bean.getProperties().get(field.getName()).getValue()));
Copy link
Owner

Choose a reason for hiding this comment

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

не только Integer же

Copy link
Author

Choose a reason for hiding this comment

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

почему нет?

field.setAccessible(true);
String value = bean.getProperties().get(field.getName()).getValue();
switch (field.getType().getTypeName().toLowerCase()) {
case "boolean":
Copy link
Owner

Choose a reason for hiding this comment

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

Я возможно пропустил, но что будет с полем типа String?

if (bean.getProperties().get(property).getType() == ValueType.VAL) {
field.setAccessible(true);
String value = bean.getProperties().get(field.getName()).getValue();
switch (field.getType().getTypeName().toLowerCase()) {
Copy link
Owner

Choose a reason for hiding this comment

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

Лучше вынести в отдельный метод

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