HBASE-24611 : Bring back old constructor of SnapshotDescription as deprecated (#1944)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
Viraj Jasani 2020-06-22 12:04:20 +05:30 committed by GitHub
parent 8f1353b447
commit 2b5ea44978
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 31 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/** /*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
@ -19,6 +19,7 @@ package org.apache.hadoop.hbase.client;
import java.util.Map; import java.util.Map;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceAudience;
@ -38,7 +39,7 @@ public class SnapshotDescription {
private final int version; private final int version;
public SnapshotDescription(String name) { public SnapshotDescription(String name) {
this(name, (TableName)null); this(name, null);
} }
public SnapshotDescription(String name, TableName table) { public SnapshotDescription(String name, TableName table) {
@ -53,6 +54,24 @@ public class SnapshotDescription {
this(name, table, type, owner, -1, -1, null); this(name, table, type, owner, -1, -1, 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
* @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 * SnapshotDescription Parameterized Constructor
* *
@ -127,16 +146,14 @@ public class SnapshotDescription {
@Override @Override
public String toString() { public String toString() {
return new StringBuilder("SnapshotDescription: ") return new ToStringBuilder(this)
.append("name = ") .append("name", name)
.append(name) .append("table", table)
.append("/table = ") .append("snapShotType", snapShotType)
.append(table) .append("owner", owner)
.append(" /owner = ") .append("creationTime", creationTime)
.append(owner) .append("ttl", ttl)
.append(creationTime != -1 ? ("/creationtime = " + creationTime) : "") .append("version", version)
.append(ttl != -1 ? ("/ttl = " + ttl) : "")
.append(version != -1 ? ("/version = " + version) : "")
.toString(); .toString();
} }
} }