You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by vj...@apache.org on 2020/06/22 06:46:22 UTC

[hbase] branch branch-2.3 updated: HBASE-24611 : Bring back old constructor of SnapshotDescription as deprecated (#1944)

This is an automated email from the ASF dual-hosted git repository.

vjasani pushed a commit to branch branch-2.3
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.3 by this push:
     new 4771c2d  HBASE-24611 : Bring back old constructor of SnapshotDescription as deprecated (#1944)
4771c2d is described below

commit 4771c2dc0a8c4236fcf7fdd23911e2eced45241e
Author: Viraj Jasani <vj...@apache.org>
AuthorDate: Mon Jun 22 12:04:20 2020 +0530

    HBASE-24611 : Bring back old constructor of SnapshotDescription as deprecated (#1944)
    
    Signed-off-by: Duo Zhang <zh...@apache.org>
---
 .../hadoop/hbase/client/SnapshotDescription.java   | 45 +++++++++++++++-------
 1 file changed, 31 insertions(+), 14 deletions(-)

diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SnapshotDescription.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SnapshotDescription.java
index 4fa825e..b003e0e 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SnapshotDescription.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SnapshotDescription.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -19,6 +19,7 @@ package org.apache.hadoop.hbase.client;
 
 import java.util.Map;
 
+import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.yetus.audience.InterfaceAudience;
 
@@ -38,7 +39,7 @@ public class SnapshotDescription {
   private final int version;
 
   public SnapshotDescription(String name) {
-    this(name, (TableName)null);
+    this(name, null);
   }
 
   /**
@@ -101,6 +102,24 @@ public class SnapshotDescription {
   /**
    * SnapshotDescription Parameterized Constructor
    *
+   * @param name Name of the snapshot
+   * @param table TableName associated with the snapshot
+   * @param type Type of the snapshot - enum SnapshotType
+   * @param owner Snapshot Owner
+   * @param creationTime Creation time for Snapshot
+   * @param version Snapshot Version
+   * @deprecated since 2.3.0 and will be removed in 4.0.0. Use
+   *   {@link #SnapshotDescription(String, TableName, SnapshotType, String, long, int, Map)}
+   */
+  @Deprecated
+  public SnapshotDescription(String name, TableName table, SnapshotType type, String owner,
+      long creationTime, int version) {
+    this(name, table, type, owner, creationTime, version, null);
+  }
+
+  /**
+   * SnapshotDescription Parameterized Constructor
+   *
    * @param name          Name of the snapshot
    * @param table         TableName associated with the snapshot
    * @param type          Type of the snapshot - enum SnapshotType
@@ -110,7 +129,7 @@ public class SnapshotDescription {
    * @param snapshotProps Additional properties for snapshot e.g. TTL
    */
   public SnapshotDescription(String name, TableName table, SnapshotType type, String owner,
-                             long creationTime, int version, Map<String, Object> snapshotProps) {
+      long creationTime, int version, Map<String, Object> snapshotProps) {
     this.name = name;
     this.table = table;
     this.snapShotType = type;
@@ -184,16 +203,14 @@ public class SnapshotDescription {
 
   @Override
   public String toString() {
-    return new StringBuilder("SnapshotDescription: ")
-            .append("name = ")
-            .append(name)
-            .append("/table = ")
-            .append(table)
-            .append(" /owner = ")
-            .append(owner)
-            .append(creationTime != -1 ? ("/creationtime = " + creationTime) : "")
-            .append(ttl != -1 ? ("/ttl = " + ttl) : "")
-            .append(version != -1 ? ("/version = " + version) : "")
-            .toString();
+    return new ToStringBuilder(this)
+      .append("name", name)
+      .append("table", table)
+      .append("snapShotType", snapShotType)
+      .append("owner", owner)
+      .append("creationTime", creationTime)
+      .append("ttl", ttl)
+      .append("version", version)
+      .toString();
   }
 }