Giter VIP home page Giter VIP logo

Comments (7)

elandau avatar elandau commented on May 27, 2024

Your pojo will need to implement the Comprable interface. Columns are stored internally in maps.

from astyanax.

tbee avatar tbee commented on May 27, 2024

It seems to me that from an API perspective the comparable logic beste be done in the getColumnByName using reflection, otherwise every one using the API needs to implement a comparable.

from astyanax.

elandau avatar elandau commented on May 27, 2024

More specifically you'll need to implement hashCode, compareTo and equals. I'll modify the docs to reflect this requirement.

from astyanax.

tbee avatar tbee commented on May 27, 2024

I really think it is a better idea to try and not have the user have to do this. It will make the implementation much uglier. Can't we use the utility methods provided by Apache commons to add these methods via reflection? The Pojo would then need to extend something, but adding three methods to create a two column composite is not nice.

from astyanax.

elandau avatar elandau commented on May 27, 2024

Point taken. I'll take a look.

from astyanax.

ash2k avatar ash2k commented on May 27, 2024

You may want to add a generic bound to enforce Comparable implementation check at compile time (with or without reflection impl. this will add safety). Also to check if hashCode() and equals() are implemented by T AnnotatedCompositeSerializer may create two instances of T in it's constructor and compare them and their hashcodes. If they are equal - methods are implemented.

public class AnnotatedCompositeSerializer<T extends Comparable<? super T>> extends AbstractSerializer<T> {

from astyanax.

ash2k avatar ash2k commented on May 27, 2024

Also in documentation for that serializer you may add a link to Guava's wiki page with examples of how to simply implement compareTo/hashCode/equals methods.

from astyanax.

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.