Java Client Riak Builders...

Brian Roach roach at basho.com
Tue May 29 13:09:48 EDT 2012


Guido -

The real fix is to enhance the client to support a Collection, I'll add an issue for this in github.

What you would need to do right now is write your own Converter (which would really just be a modification of our JSONConverter if you're using JSON) that does this for you. 

If you look at the source for JSONConverter you'll see where the indexes are processed.  As it is, the index processing is handled by the RiakIndexConverter<T> class which is where the limitation of requiring the annotated field to be a String is coming from (it's actually buried lower than that in the underlying annotation processing, but that's the starting point for the problem). The actual RiakIndexes class that encapsulates the data and exists in the IRiakObject doesn't have this problem. 

The catch is that you'll need to do all the reflection ugliness yourself, as that's the part that's broken (the annotation processing). 

Basically, in JSONConverter.fromDomain() you would need to replace
RiakIndexes indexes = riakIndexConverter.getIndexes(domainObject);
with your own annotation processing. The same would need to be done in JSONConverter.toDomain() at
riakIndexConverter.populateIndexes(…) 

Obviously this is not ideal and I'm considering it a bug; I'll put this toward to top of the list of things I'm working on right now. 

Thanks,
Brian Roach

 


On May 28, 2012, at 8:03 AM, Guido Medina wrote:

> Hi,
> 
>  I'm looking for a work around @RiakIndex annotation to support multiple values per index name, since the annotation is limited to one single value per annotated property (no collection support), I would like to know if there is a way of using the DomainBucketBuilder, mutation & conflict resolver and at the same time has access to a method signature like addIndex(String or int)...addIndex(String or int)...build() same as you can do with RiakObjectBuilder which lacks support for conflict resolution and mutation style.
> 
> 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