Skip to content

Commit

Permalink
Fix: All cells are nulls if setter returns anything but void
Browse files Browse the repository at this point in the history
  • Loading branch information
pbacz committed Jan 3, 2024
1 parent 18cf427 commit c0b625c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/io/github/millij/poi/util/Beans.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static String getFieldName(final Method method) {
*/
public static String getFieldValueAsString(final Object beanObj, final String fieldName) throws Exception {
// Property Descriptor
final PropertyDescriptor pd = new PropertyDescriptor(fieldName, beanObj.getClass());
final PropertyDescriptor pd = PROP_UTILS_BEAN.getPropertyDescriptor(beanObj, fieldName);
final Method getterMtd = pd.getReadMethod();

final Object value = getterMtd.invoke(beanObj);
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/io/github/millij/bean/Employee.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ public String getId() {
return id;
}

public void setId(String id) {
public Employee setId(String id) {
this.id = id;
return this;
}

@SheetColumn("Name")
Expand Down

0 comments on commit c0b625c

Please sign in to comment.