[1.4.1] POJO beans with chained/fluent setters fail to serialize
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 65/100
Research direction
Start at BeanPropertyType and trace how the TypeInformation and DefaultMapper handle the getters and setters shown in the reproducing example. Reproduce the issue with the chained CustomConfigProperty bean and verify that fluent setters are recognized and YAML serialization and loading preserve the bean properties.
Written by the indexing model from the issue text.
Description
Context
Version: 1.4.1
JDK: 8
When defining configuration POJO beans mapped by ConfigMe's BeanPropertyType, using fluent setter methods (such as those generated by Lombok's @Accessors(chain = true) or custom return this; setters) breaks the JavaBean property introspection.
Reproducing Example
Consider a simplified configuration bean:
import lombok.*;
import lombok.experimental.Accessors;
@Getter
@Setter
@Accessors(chain = true)
@NoArgsConstructor(access = AccessLevel.PUBLIC)
public class CustomConfigProperty {
private boolean enabled = true;
private String fileName = "";
private int weight = 1;
private int minHeight = 0;
private int maxHeight = 255;
}
When registering and saving this bean via ConfigMe:
public static final Property<CustomConfigProperty[]> PROPERTIES =
new PropertyBuilder.ArrayPropertyBuilder<>(
new BeanPropertyType<>(new TypeInformation(CustomConfigProperty.class), DefaultMapper.getInstance()),
CustomConfigProperty[]::new)
.path("custom.properties")
.defaultValue(new CustomConfigProperty[0])
.build();
Expected Behavior
ConfigMe should map the bean's fields to YAML properties based on getters and setters.
Actual Behavior
ConfigMe does not recognize the fluent setters, resulting in empty YAML outputs or unpopulated instances when reading from configuration files.
Thank you ❤️
- Dominant language
- Java
- Stars
- 44
- Forks
- 21
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AuthMe/ConfigMe
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
architecture
Difficulty 4/5 3-5 days Newbie friendliness 38/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100