Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make code compatible with java8 date api #126

Closed
msangel opened this issue Mar 29, 2019 · 1 comment · Fixed by #128
Closed

Make code compatible with java8 date api #126

msangel opened this issue Mar 29, 2019 · 1 comment · Fixed by #128

Comments

@msangel
Copy link
Collaborator

msangel commented Mar 29, 2019

Currently the java.time.Instant class is not recognized as date type. Also it would be nice to have compatible api. The library have java7 compatibility so we cannot use Instant in it, but we should provide east way to plug it in.

@msangel
Copy link
Collaborator Author

msangel commented Mar 29, 2019

Sample usage after applying fix:

Filter.registerFilter(Date.withCustomDateType(new Date.CustomDateFormatSupport<Instant>() {
            @Override
            public Long getAsSeconds(Instant value) {
                return value.getEpochSecond();
            }

            @Override
            public boolean support(Object in) {
                return Instant.class.isInstance(in);
            }
}));

Note: this will override old date type, so if you want to have multiple new supported types, this support should be made in scope of one overridden instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant