Skip to content

Commit

Permalink
WIP commit.
Browse files Browse the repository at this point in the history
Added a doclet that allows filtering out inner classes (the
extendable builder thing clutters up the javadoc)
  • Loading branch information
Brian Roach committed Mar 29, 2014
1 parent d765043 commit 3a43485
Show file tree
Hide file tree
Showing 30 changed files with 669 additions and 229 deletions.
21 changes: 7 additions & 14 deletions pom.xml
Expand Up @@ -168,27 +168,20 @@
<tagletArtifact>
<groupId>com.basho.riak</groupId>
<artifactId>riak-client</artifactId>
<version>2.0.0-ALPHA1-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
</tagletArtifact>
</taglet>
</taglets>
<doclet>com.basho.riak.client.javadoc.JavadocFilter</doclet>
<docletArtifact>
<groupId>com.basho.riak</groupId>
<artifactId>riak-client</artifactId>
<version>2.0.0-SNAPSHOT</version>
</docletArtifact>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>netty-snapshot-repository</id>
<url>http://repository-netty.forge.cloudbees.com/snapshot/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>com.sun</groupId>
Expand Down
Expand Up @@ -22,8 +22,37 @@
import java.lang.annotation.Target;

/**
*
* Annotates a field or getter/setter method pair in a class to serve as the bucket name.
* <p>
* The type must be a {@code String}.
*
* <pre>
* class MyPojo
* {
* {@literal @}RiakBucketName
* String bucketName;
* }
*
* class MyPojo
* {
* private String bucketName;
*
* {@literal @}RiakBucketName
* public void setBucketName(String bucketName)
* {
* this.bucketName = bucketName;
* }
*
* {@literal @}RiakBucketName
* public String getBucketName()
* {
* return bucketName;
* }
* }
* </pre>
* <p>
* @author Brian Roach <roach at basho dot com>
* @since 2.0
*/
@Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.METHOD}) public @interface RiakBucketName
{
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2014 Basho Technologies
* Copyright 2014 Basho Technologies Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,8 +22,37 @@
import java.lang.annotation.Target;

/**
*
* Annotates a field or getter/setter method pair in a class to server as the bucket type.
* <p>
* The type must be a {@code String}.
*
* <pre>
* class MyPojo
* {
* {@literal @}RiakBucketType
* String bucketType;
* }
*
* class MyPojo
* {
* private String bucketType;
*
* {@literal @}RiakBucketType
* public void setBucketType(String bucketType)
* {
* this.bucketType = bucketType;
* }
*
* {@literal @}RiakBucketType
* public String getBucketType()
* {
* return bucketType;
* }
* }
* </pre>
* </p>
* @author Brian Roach <roach at basho dot com>
* @since 2.0
*/
@Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.METHOD}) public @interface RiakBucketType
{
Expand Down
Expand Up @@ -9,7 +9,7 @@
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* WITHOUT WARANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Expand All @@ -23,7 +23,39 @@


/**
*
* Annotates a field or getter/setter method pair in a class to serve as the content-type.
* <p>
* The type must be a {@code String}.
* </p>
* <p>
* In most cases this is not needed as the {@link com.basho.riak.client.convert.Converter}
* will supply the appropriate content-type during serialization.
*
* <pre>
* class MyPojo
* {
* {@literal @}RiakContentType
* String contentType;
* }
*
* class MyPojo
* {
* private String contentType;
*
* {@literal @}RiakContentType
* public void setContentType(String contentType)
* {
* this.contentType = contentType;
* }
*
* {@literal @}RiakContentType
* public String getContentType()
* {
* return contentType;
* }
* }
* </pre>
* <p>
* @author Brian Roach <roach at basho dot com>
* @since 2.0
*/
Expand Down
60 changes: 38 additions & 22 deletions src/main/java/com/basho/riak/client/annotations/RiakIndex.java
Expand Up @@ -19,42 +19,58 @@
import java.lang.annotation.Target;

/**
* Annotation to declare a field or getter/setter pair as a RiakIndex.
* Annotates a field or getter/setter method pair in a class to serve as a RiakIndex.
* <p>
* You do not need to specify the index type prefix (_bin/_int). It will be
* inferred from the type of the annotated field.
*
* Only String/Long/long or {@code Set<String>} / {@code Set<Long>} fields
* may be annotated with RiakIndex.
* You do not need to specify the index type suffix ({@code _bin}/{@code _int}). It will be
* inferred from the type of the annotated field <b>except when using {@code byte[]}</b>;
* in this case the full index name including the suffix must be supplied.
* </p>
* <p>
* <b>NOTE: if there are *multiple* values for the same named index and the field
* in the domain object is an long, Long, or String only the 1st will find
* it's way into the domain object</b>
* For {@code _bin} indexes, {@code String} and {@code byte[]} types are supported.
* For {@code _int} indexes, {@code Long}, {@code BigInteger} and {@code byte[]}
* are supported. This can either be a single instance or a {@code Set}.
* </p>
* <p>
* For example:
* <b>Important Note:</b> if there are multiple index keys for the object and the field
* is a single value rather than a {@code Set}, only a single index key will be
* set (the first returned).
* </p>
* <pre>
*
* public class MyClass {
* &#064;RiakKey
* public class MyClass
* {
* {@literal @}RiakKey
* private String myKeyString;
*
* &#064;RiakIndex(name="email")
* private String emailAddress; // will be indexed in email_bin index
* {@literal @}RiakIndex(name="email")
* private {@literal Set<String>} emailAddress; // will be indexed in the email_bin index
*
* &#064;RiakIndex(name="age")
* private long age; // will be index in age_int index
* {@literal @}RiakIndex(name="age")
* private long age; // will be indexed in the age_int index
* }
*
* </pre>
*
* public class MyClass
* {
* private {@literal Set<Long>} categoryIds;
*
* {@literal @}RiakIndex(name="category_ids")
* public {@literal Set<String>} getCategoryIds()
* {
* return categoryIds;
* }
*
* @author russell
* @see JSONConverter
*/
* {@literal @}RiakIndex(name="category_ids")
* public void setCategoryIds({@literal Set<String>} ids)
* {
* categoryIds = ids;
* }
* }
*
* </pre>
*
* @author Russell Brown
* @author Brian Roach <roach at basho dot com>
* @since 1.0
*/
@Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.METHOD}) public @interface RiakIndex {
/**
* @return the index name
Expand Down
46 changes: 27 additions & 19 deletions src/main/java/com/basho/riak/client/annotations/RiakKey.java
@@ -1,15 +1,17 @@
/*
* This file is provided to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* Copyright 2014 Basho Technologies Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.basho.riak.client.annotations;

Expand All @@ -19,31 +21,37 @@
import java.lang.annotation.Target;

/**
* Annotation to declare a field or getter/setter pair as the key to a data item in Riak.
* Annotates a field or getter/setter method pair in a class to serve as the key.
* <p>
* This annotation can be used either on a field, or getter/setter pair of methods.
* The type must be a {@code String}.
* <p>
*
* <pre>
* public class MyPojo {
* &#064;RiakKey public String key;
* public class MyPojo
* {
* {@literal @}RiakKey
* public String key;
* }
*
* public class AnotherPojo {
* public class AnotherPojo
* {
* private String key;
*
* &#064;RiakKey public String getKey() {
* {@literal @}RiakKey
* public String getKey()
* {
* return key;
* }
*
* &#064;RiakKey public void setKey(String key) {
* {@literal @}RiakKey
* public void setKey(String key)
* {
* this.key = key;
* }
* }
* </pre>
* @author russell
* @author Russell Brown <russelldb at basho dot com>
* @author Brian Roach <roach at basho dot com>
* @see JSONConverter
* @since 1.0
*/
@Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.METHOD}) public @interface RiakKey {

Expand Down
Expand Up @@ -22,7 +22,31 @@
import java.lang.annotation.Target;

/**
*
* Annotates a field or setter method in a class to store last modified.
* <p>
* This value is only populated when fetching an object from riak. Setting it when
* storing an object has no effect. A getter method is not supported; only a setter
* method may be annotated. The type must be {@literal long} or {@literal Long}.
*
* <pre>
* class MyPojo
* {
* {@literal @}RiakLastModified
* Long lastModified;
* }
*
* class MyPojo
* {
* private Long lastModified;
*
* {@literal @}RiakLastModified
* public void setLastModified(Long lastModified)
* {
* this.lastModified = lastModified;
* }
* }
* </pre>
*
* @author Brian Roach <roach at basho dot com>
* @since 2.0
*/
Expand Down

0 comments on commit 3a43485

Please sign in to comment.