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

#135 Support more ways to create beans (e.g. Java records) #398

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

ljacqu
Copy link
Member

@ljacqu ljacqu commented Nov 17, 2023

No description provided.

Copy link
Member Author

@ljacqu ljacqu left a comment

Choose a reason for hiding this comment

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

Adapt javadoc on MapperImpl

@coveralls
Copy link

coveralls commented Oct 6, 2024

Coverage Status

coverage: 99.324% (-0.09%) from 99.416%
when pulling a7e1ada on 135-support-data-classes-draft
into 3649924 on master.

@ljacqu ljacqu force-pushed the 135-support-data-classes-draft branch from 68bfefe to 0a8e9bd Compare October 18, 2024 18:25
@ljacqu ljacqu marked this pull request as ready for review October 18, 2024 18:25
src/main/java/ch/jalu/configme/beanmapper/MapperImpl.java Outdated Show resolved Hide resolved
src/main/java/ch/jalu/configme/beanmapper/MapperImpl.java Outdated Show resolved Hide resolved
src/main/java/ch/jalu/configme/beanmapper/MapperImpl.java Outdated Show resolved Hide resolved
protected @NotNull List<BeanPropertyDescription> getBeanProperties(@NotNull Object value) {
return beanInstantiationService.findInstantiation(value.getClass())
.map(BeanInstantiation::getProperties)
.orElse(Collections.emptyList());
Copy link
Member Author

Choose a reason for hiding this comment

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

Interesting to note that here a bean instantiation is retrieved during the export to find out what properties it has. Maybe "instantiation" is not a good name? No better idea at the time of writing

private String name; // Ignore name of parent

@ExportName("o_ratio")
private float ratio; // Override name of Middle#ratio
Copy link
Member Author

Choose a reason for hiding this comment

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

The Wiki should have an example like this

Copy link
Member Author

Choose a reason for hiding this comment

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

Check behavior when a class has no bean instantiation: I think there was some weird behavior. Mapping should be stopped.

* <p>
* Default implementation is {@link BeanPropertyDescriptionImpl}.
* Default implementation of this interface is {@link BeanFieldPropertyDescription}.
*/
public interface BeanPropertyDescription {
Copy link
Member Author

Choose a reason for hiding this comment

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

Still not fully happy with the names here. Is Description right? Should it be just BeanComponent?
What about the BeanDescriptionFactory?

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably need to create another issue to change the mapping context. It should be able to have more info to support generic types in the future.

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

Successfully merging this pull request may close these issues.

2 participants