Add support for java records
See original GitHub issueIt would be awesome to map an xls/xlsx record to a java record, like this one:
public record MyRecord(
@ExcelCellName("Writing code")
String writingCode
) {
}
… but currently Poiji throws an exception:
com.poiji.exception.PoijiInstantiationException: Cannot create a new instance of com.model.MyRecord
at com.poiji.util.ReflectUtil.newInstanceOf(ReflectUtil.java:28)
at com.poiji.bind.mapping.HSSFUnmarshaller.deserializeRowToInstance(HSSFUnmarshaller.java:163)
at com.poiji.bind.mapping.HSSFUnmarshaller.processRowsToObjects(HSSFUnmarshaller.java:97)
at com.poiji.bind.mapping.HSSFUnmarshaller.unmarshal(HSSFUnmarshaller.java:80)
at com.poiji.bind.Poiji.fromExcel(Poiji.java:220)
at com.poiji.bind.Poiji.fromExcel(Poiji.java:196)
....
....
....
....
....
Caused by: java.lang.NoSuchMethodException: com.model.MyRecord.<init>()
at java.base/java.lang.Class.getConstructor0(Class.java:3508)
at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2711)
at com.poiji.util.ReflectUtil.newInstanceOf(ReflectUtil.java:22)
... 108 common frames omitted
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
4 Records - Java - Oracle Help Center
JDK 14 introduces records, which are a new kind of type declaration. Like an enum, a record is a restricted form of a...
Read more >Java 14 Record Keyword - Baeldung
With the release of Java 14, we can now use records to remedy these problems. In this tutorial, we'll look at the fundamentals...
Read more >Java 14 Records Class | DigitalOcean
Java 14 introduced a new way to create classes called Records. ... Both Eclipse and IntelliJ already provide support for Java 14, ...
Read more >[#FREEMARKER-183] Add support for Java records - ASF JIRA
Hi, ddekany! Is there any progress on this issue? Java Records became standard and next LTS release was publised (Java 17). Maybe you...
Read more >How to use Record in Java? Example - Java67
Can you add static methods on Java records? You can add static methods inside the java record definition. This allows having access to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @ozlerhakan I will take a look once I have free time, but I don’t promise, maybe someone else will do it before me
right now there are some limits to unable java records on Poiji. This does not mean that we don’t add it to Poiji, however, once we handle it, I re open this issue to integrate it.