Riak Java client question

Guido Medina gmedina at temetra.com
Thu Jun 22 04:59:44 EDT 2017


Also, a property annotated with a Riak annotation was kept in the Json 
only if it has been explicitly annotated with @JsonProperty or has not 
been annotated with a Riak property.

This was accomplished with the following code from the old client:

>     static {
>         RIAK_ANNOTATIONS.add(RiakKey.class);
>         RIAK_ANNOTATIONS.add(RiakIndex.class);
>         RIAK_ANNOTATIONS.add(RiakVClock.class);
>         RIAK_ANNOTATIONS.add(RiakTombstone.class);
>         RIAK_ANNOTATIONS.add(RiakUsermeta.class);
>         RIAK_ANNOTATIONS.add(RiakLinks.class);
>     }
>
>     private boolean keepProperty(BeanPropertyWriter beanPropertyWriter) {
>         if (beanPropertyWriter.getAnnotation(JsonProperty.class) != 
> null) {
>             return true;
>         }
>         for (Class<? extends Annotation> annotation : RIAK_ANNOTATIONS) {
>             if (beanPropertyWriter.getAnnotation(annotation) != null) {
>                 return false;
>             }
>         }
>         return true;
>     }

So my other question is if this still holds true for the current Riak 
Java client 2.1.1?

On 22/06/17 09:49, Guido Medina wrote:
> Hi,
>
> I see now there is support for 2i which we needed in order to migrate 
> to 2.x, there was another issue with the old client which forced us to 
> modify the client, such issue was related to the following, let me put 
> an example:
>
> public class POJO {
>
>   @RiakKey
>   public String getKey() {
>     // generate our own key
>   }
>
>   @RiakIndex("some-index")
>   @JsonIgnore
>   public String getSomeIndex() {
>     // generate some index
>   }
>
> }
>
> The following example should add "some-index" but ignore it as a Json 
> property, and as you can see the Riak key is a pseudo (computed) 
> property and has no setter, at some point Riak client 1.4.x required 
> that the key be a property which IMHO is a very poor design to require 
> the POJO to have some properties to hold internal Riak client values 
> between calls.
>
> I'm wondering what's the current POJO support as we have been stuck 
> for years now with that old Riak client 1.4.x with our modifications, 
> we are afraid that one day it will simply not be supported anymore by 
> a newer Riak server.
>
> Regards,
>
> Guido.
>
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>





More information about the riak-users mailing list