I will request a "pull request", I fixed it, I enabled @RiakIndex for
collection fields AND methods (String, Integer or Collection of any of
those), on our coding is working, but still I need to test it more before
making it final.
I will share the details tomorrow, I already created a fork from your master
branch.
Now you can have something like:
@RiakIndex
@JsonIgnore
Collection<Integer> getNumbers()
Also this works as index and with no getter (as of 1.0.6-SNAPSHOT) will only
be that, an index:
@RiakIndex
Collection<String> numbers;
That will act as index and be ignored as property which is the intention of
the index, to be a dynamic calculated value(s) and not as property which
requires the caller to call a post-construct.
And of course, all subclasses of a collection apply.
Thanks for the answer,
Guido.
-----Original Message-----
From: Brian Roach
Sent: Tuesday, May 29, 2012 6:09 PM
To: Guido Medina
Cc: [email protected]
Subject: Re: Java Client Riak Builders...
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
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com