Replies: 5 comments 5 replies
-
That would be great! I think I also have similar type handlers somewhere in a previous project. I wonder if we have to use a different type handler for each class (and also Also, this means that BeanIO 3 will have a minimal requirement of Java 8 instead of Java 7 currently. |
Beta Was this translation helpful? Give feedback.
-
Here's what I have so far: https://github.com/beanio/beanio/blob/33e3461b28c1b7be14edd5c5fddd3b219cc9ada9/src/org/beanio/types/TemporalAccessorTypeHandler.java It's a single class that's registered multiple times in the defaultFactory.registerHandlerFor(
LocalDate.class,
new TemporalAccessorTypeHandler(LocalDate.class, DateTimeFormatter.ISO_LOCAL_DATE)
);
defaultFactory.registerHandlerFor(
LocalTime.class,
new TemporalAccessorTypeHandler(LocalTime.class, DateTimeFormatter.ISO_LOCAL_TIME)
);
... It uses ISO formats by default, but users can define their own formats like this: <record name="rec" class="org.beanio.beans.JavaTime" occurs="1">
<field name="localDateTime" length="17" format="dd/MM/yy HH:mm:ss"/>
</record> And for subclasses of @Override
public TemporalAccessor parse(String text) throws TypeConversionException {
return DayOfWeek.from(super.parse(text));
} |
Beta Was this translation helpful? Give feedback.
-
Hey @bjansen - it looks like this was merged in as part of #144 but has it been released? I am using
Thanks for all the great work on this project! |
Beta Was this translation helpful? Give feedback.
-
I'm also getting
|
Beta Was this translation helpful? Give feedback.
-
@willsoto @Manfred73 sorry for the (very) late reply. Support for I'll release a new milestone. |
Beta Was this translation helpful? Give feedback.
-
@bjansen
I can donate some of my existing code for handling some of the
java.time
classes. I don't have too manyTypeHandlers
implemented but the basic ones should be there to handlejava.time.LocalDate
,java.time.LocalTime
andjava.time.LocalDateTime
. It could perhaps be the starting point for the otherjava.time
classes.Beta Was this translation helpful? Give feedback.
All reactions