keith-turner commented on a change in pull request #347: ACCUMULO-4746 Fluent 
API for Mutation
URL: https://github.com/apache/accumulo/pull/347#discussion_r158940397
 
 

 ##########
 File path: core/src/main/java/org/apache/accumulo/core/data/Mutation.java
 ##########
 @@ -772,6 +772,380 @@ public void putDelete(byte[] columnFamily, byte[] 
columnQualifier, ColumnVisibil
     put(columnFamily, columnQualifier, columnVisibility.getExpression(), true, 
timestamp, true, EMPTY_BYTES);
   }
 
+  /**
+   * Fluent API for Mutation
+   *
+   * <p>
+   * Each step of the Mutation is represented by an interface. Inheritance 
hierarchy ensures that chained methods follow prescribed order of: family, 
qualifier,
+   * visibility, timestamp.
+   *
+   * <p>
+   * Methods are optional, meaning that one or may be omitted within a chain.
+   *
+   * <p>
+   * Set and delete methods end the chain and finalize the mutation by filling 
Mutation's UnsynchronizedBuffer.
+   */
+
+  /**
+   * Provides methods for setting the column family of a Mutation. The user 
can provide the family name as a byte array, CharSequence, ByteBuffer, or Text
+   * object instance and the backend will do the necessary transformation.
+   *
+   * All FamilyStep methods return an instance derived from the QualifierStep 
interface, allowing the methods to be semantically chained.
+   *
+   * @since 2.0
+   */
+  public interface FamilyStep extends QualifierStep {
+    QualifierStep family(byte[] colFam);
+
+    QualifierStep family(CharSequence colFam);
+
+    QualifierStep family(ByteBuffer colFam);
+
+    QualifierStep family(Text colFam);
+  }
+
+  /**
+   * Provides methods for setting the column qualifier of a Mutation. The user 
can provide the qualifier name as a byte array, CharSequence, ByteBuffer, or 
Text
+   * object instance and the backend will do the necessary transformation.
+   *
+   * All QualifierStep methods return an instance derived from the 
VisibilityStep interface, allowing the methods to be semantically chained.
+   *
+   * @since 2.0
+   */
+  public interface QualifierStep extends VisibilityStep {
+    VisibilityStep qualifier(byte[] colQual);
+
+    VisibilityStep qualifier(CharSequence colQual);
+
+    VisibilityStep qualifier(ByteBuffer colQual);
+
+    VisibilityStep qualifier(Text colQual);
+  }
+
+  /**
+   * Provides methods for setting the column visibility of a Mutation. The 
user can provide the visibility as a byte array or
+   * {@link org.apache.accumulo.core.security.ColumnVisibility} object 
instance and the backend will do the necessary transformation.
+   *
+   * All QualifierStep methods return an instance derived from the 
VisibilityStep interface, allowing the methods to be semantically chained.
+   *
+   * @since 2.0
+   */
+  public interface VisibilityStep extends TimestampStep {
+    TimestampStep visibility(byte[] colVis);
+
+    TimestampStep visibility(ColumnVisibility colVis);
+  }
+
+  /**
+   * Provides methods for setting the timestamp of a Mutation. The user must 
provide the timestamp as a long.
+   *
+   * All TimestampStep methods return an instance derived from the 
MutationStep interface, allowing the methods to be semantically chained.
+   *
+   * @since 2.0
+   */
+  public interface TimestampStep extends MutationStep {
+    MutationStep timestamp(long ts);
+  }
+
+  /**
+   * Provides methods for setting the value of a Mutation. The user can 
provide the value as a byte array, Value, or ByteBuffer object instance and the 
backend
+   * will do the necessary transformation.
+   *
+   * All MutationStep methods complete a fluent Mutation API method chain.
+   *
+   * @since 2.0
+   */
+  public interface MutationStep {
 
 Review comment:
   There should be set methods that take CharSeq, Text, and byte[]

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to