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_r158283704
########## File path: core/src/main/java/org/apache/accumulo/core/data/Mutation.java ########## @@ -772,6 +772,236 @@ 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 order ensures that chained methods follow prescribed order of: + * + * <p> + * row, family, qualifier, visibility, timestamp + * + * <p> + * set and delete methods end the chain and finalize the mutation + */ + public interface RowStep extends FamilyStep { + FamilyStep row(byte[] r); + + FamilyStep row(CharSequence r); + + FamilyStep row(ByteBuffer r); + + FamilyStep row(Text t); + } + + public interface FamilyStep extends QualifierStep { + QualifierStep family(byte[] f); + + QualifierStep family(CharSequence f); + + QualifierStep family(ByteBuffer f); + + QualifierStep family(Text t); + } + + public interface QualifierStep extends VisibilityStep { + VisibilityStep qualifier(byte[] q); + + VisibilityStep qualifier(CharSequence q); + + VisibilityStep qualifier(ByteBuffer q); + + VisibilityStep qualifier(Text t); + } + + public interface VisibilityStep extends TimestampStep { + TimestampStep visibility(byte[] cv); + + TimestampStep visibility(ColumnVisibility cv); + } + + public interface TimestampStep extends MutationStep { + MutationStep timestamp(long t); + } + + public interface MutationStep { + void set(byte[] v, boolean delete); + + void set(ByteBuffer v); + + void set(Value v); + + void delete(); + } + + public RowStep at() { Review comment: This method will need a `@since 2.0` javadoc tag. ---------------------------------------------------------------- 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