Giter Site home page Giter Site logo

Comments (7)

magro avatar magro commented on August 15, 2024

You're right, currently there are no such serializers, only for joda DateTime and Interval. It shouldn't be hard to write serializers for LocalDate and LocalDateTime, pull requests are welcome :-) If you need help writing them just ask.

from kryo-serializers.

RenniePet avatar RenniePet commented on August 15, 2024

OK, "I'll try anything once" - despite having limited Java skills and almost zero GitHub skills.

Before me submitting a pull request, would you mind first taking a look at this: https://github.com/RenniePet/kryo-serializers/tree/additional-joda-time ?

It turned out to be more problematic than I expected. These two Joda-Time objects do have a millis fields burried inside them, but they are difficult to access (protected getters) and/or are not usable in the constructors.

I'm afraid there are no unit tests. I'm ashamed to admit that I've never written a unit test in my life. And even if I tried to fake it, I don't know how to run unit tests.

I've left your name and email address in the comments, partly because of the lack of unit tests. Would you prefer I inserted my own name?

Let me know what you think.

from kryo-serializers.

magro avatar magro commented on August 15, 2024

Sorry for responding that late, I'm just coming back from vacation.

Am 03.03.2015 15:55 schrieb "RenniePet" [email protected]:

OK, "I'll try anything once" - despite having limited Java skills and almost zero GitHub skills.

Before me submitting a pull request, would you mind first taking a look at this: https://github.com/RenniePet/kryo-serializers/tree/additional-joda-time ?

It turned out to be more problematic than I expected. These two Joda-time objects do have a millis fields burried inside them, but they are difficult to access (protected getters) and/or are not usable in the constructors.

Fine, I see the following potential improvements:

  • use setInt(..., true) to save some bytes
  • serialize localDateTime.getMillisOfDay instead of
    hour/minute/second/millis to save bytes and calculate
    hour/minute/second/millis on deserialization.

I'm afraid there are no unit tests. I'm ashamed to admit that I've never written a unit test in my life. And even if I tried to fake it, I don't know how to run unit tests.

You could build upon one of the existing tests.
To run all tests do 'mvn test', to run a single test run 'mvn -Dtest=SomeTestClass test' (see also
http://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.html).
If you're using an IDE you can also install a testng plugin (most IDEs only support only junit out of the box) and run the test from your IDE.

I've left your name and email address in the comments, partly because of the lack of unit tests. Would you prefer I inserted my own name?

Yes, you should receive the credits for your work. :-)

Cheers,
Martin

Let me know what you think.


Reply to this email directly or view it on GitHub.

from kryo-serializers.

RenniePet avatar RenniePet commented on August 15, 2024

OK, I think I've made the improvements you requested. I'll try to create unit tests later today, and then submit a pull request.

from kryo-serializers.

magro avatar magro commented on August 15, 2024

Cool!
Am 12.03.2015 07:37 schrieb "RenniePet" [email protected]:

OK, I think I've made the improvements you requested. I'll try to create
unit tests later today, and then submit a pull request.


Reply to this email directly or view it on GitHub
#29 (comment)
.

from kryo-serializers.

RenniePet avatar RenniePet commented on August 15, 2024

A pull request has now been submitted. Hope you can use it.

One strange thing I've experienced is that the two "copy" unit test methods do not invoke my serialization/deserialization code at all! Kryo is apparently able to (and prefers to) copy these objects without serializing and deserializing them, at least as objects. Maybe it "serializes" and "deserializes" the individual fields? Anyway, these two copy unit test methods are somewhat misleading, since they aren't actually testing what they claim to be testing. Maybe they should be removed? (I'm running Java on an old Android device, if that has anything to do with it.)

from kryo-serializers.

magro avatar magro commented on August 15, 2024

This is merged/released already.

from kryo-serializers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.