Repository navigation
Merge dropwizard-java8 addon into mainline - #1365
Conversation
dropwizard-java8 used to provide support for Java 8 classes like `Optional<T>` and the Java Date and Time API (JSR-310) for Dropwizard. Given that the baseline for Dropwizard is now Java 8, those additions can be maintained in the mainline repository. The only backward-incompatible change is in the `io.dropwizard.auth.Authenticator` interface which is now using `java.util.Optional` instead of the equivalent class from Google Guava. Closes #962
|
This looks good to me, thanks for all the work in integrating this! Any other feedback @dropwizard/committers ? |
|
@joschi, what do you think about creating public class GuavaOptionalDBIFactory extends DBIFactory {
@Override
public DBI build(Environment environment, PooledDataSourceFactory configuration,
ManagedDataSource dataSource, String name) {
final DBI dbi = super.build(environment, configuration, dataSource, name);
dbi.registerArgumentFactory(new GuavaOptionalArgumentFactory(
configuration.getDriverClass()));
dbi.registerContainerFactory(new GuavaOptionalContainerFactory());
final Optional<TimeZone> timeZone = databaseTimeZone();
dbi.registerArgumentFactory(new GuavaOptionalJodaTimeArgumentFactory(timeZone));
dbi.registerArgumentFactory(new GuavaOptionalLocalDateArgumentFactory());
dbi.registerArgumentFactory(new GuavaOptionalLocalDateTimeArgumentFactory());
dbi.registerArgumentFactory(new GuavaOptionalInstantArgumentFactory(timeZone));
dbi.registerArgumentFactory(new GuavaOptionalOffsetTimeArgumentFactory(timeZone));
dbi.registerArgumentFactory(new GuavaOptionalZonedTimeArgumentFactory(timeZone));
return dbi;
}
}What do you think? If such modularity is too controversial, I think we could at least move Guava's |
|
I am also a bit of worried about mixing Joda-Time and JSR 310 support. Unfortunately, I don't see a way how could we modularize the support of these libraries. Removing Joda-Time support in favour of JSR 310 is also not an option. I believe, for the time being, we have to force users to import Joda-Time, even if they don't use it. |
|
@arteam In my opinion Dropwizard should "just work" with Google Guava and Joda-Time additionally to the APIs provided by JDK 8 and higher (JSR-310 and Optional). Backward compatibility with older Dropwizard versions isn't exactly required for Dropwizard 1.0.0, but it's a nice feature. 😉 |
Merge dropwizard-java8 addon into mainline
|
Ok, fair enough. The rest changes look good to me. Thanks for your hard work! |
dropwizard-java8used to provide support for Java 8 classes likeOptional<T>and the Java Date and Time API (JSR-310) for Dropwizard. Given that the baseline for Dropwizard is now Java 8, those additions can be maintained in the mainline repository.The only backward-incompatible change is in the
io.dropwizard.auth.Authenticatorinterface which is now usingjava.util.Optionalinstead of the equivalent class from Google Guava.Closes #962