@Retention(value=RUNTIME) @Target(value={java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD}) public @interface RiakIndex
You do not need to specify the index type suffix (_bin
/_int
). It will be
inferred from the type of the annotated field except when using byte[]
;
in this case the full index name including the suffix must be supplied.
For _bin
indexes, String
and byte[]
types are supported.
For _int
indexes, Long
, BigInteger
and byte[]
are supported. This can either be a single instance or a Set
.
Important Note: if there are multiple index keys for the object and the field
is a single value rather than a Set
, only a single index key will be
set (the first returned).
public class MyClass { @RiakKey private String myKeyString; @RiakIndex(name="email") private Set<String> emailAddress; // will be indexed in the email_bin index @RiakIndex(name="age") private long age; // will be indexed in the age_int index } public class MyClass { private Set<Long> categoryIds; @RiakIndex(name="category_ids") public Set<String> getCategoryIds() { return categoryIds; } @RiakIndex(name="category_ids") public void setCategoryIds(Set<String> ids) { categoryIds = ids; } }
public abstract String name
Copyright © 2014. All rights reserved.