Skip to content

Commit 2859512

Browse files
committed
HBASE-16002 Made constructors of DataType subclasses public
1 parent ed30909 commit 2859512

33 files changed

+1232
-94
lines changed

hbase-common/src/main/java/org/apache/hadoop/hbase/types/OrderedBlob.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,23 @@
2929
@InterfaceAudience.Public
3030
public class OrderedBlob extends OrderedBytesBase<byte[]> {
3131

32+
/**
33+
* @deprecated since 3.0.0 and will be removed in 4.0.0
34+
*/
35+
@Deprecated
3236
public static final OrderedBlob ASCENDING = new OrderedBlob(Order.ASCENDING);
37+
/**
38+
* @deprecated since 3.0.0 and will b removed in 4.0.0
39+
*/
40+
@Deprecated
3341
public static final OrderedBlob DESCENDING = new OrderedBlob(Order.DESCENDING);
3442

35-
protected OrderedBlob(Order order) {
43+
/**
44+
* Creates a new {@code byte[]} with variable length.
45+
*
46+
* @param order the {@link Order} to use
47+
*/
48+
public OrderedBlob(Order order) {
3649
super(order);
3750
}
3851

@@ -65,6 +78,12 @@ public int encode(PositionedByteRange dst, byte[] val) {
6578

6679
/**
6780
* Write a subset of {@code val} to {@code dst}.
81+
*
82+
* @param dst the {@link PositionedByteRange} to write to
83+
* @param val the value to write to {@code dst}
84+
* @param voff the offset in {@code dst} where to write {@code val} to
85+
* @param vlen the lenght of {@code val}
86+
* @return the number of bytes written
6887
*/
6988
public int encode(PositionedByteRange dst, byte[] val, int voff, int vlen) {
7089
return OrderedBytes.encodeBlobCopy(dst, val, voff, vlen, order);

hbase-common/src/main/java/org/apache/hadoop/hbase/types/OrderedBlobVar.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,18 @@
2929
*/
3030
@InterfaceAudience.Public
3131
public class OrderedBlobVar extends OrderedBytesBase<byte[]> {
32-
32+
/**
33+
* @deprecated since 3.0.0 and will be removed in 4.0.0
34+
*/
35+
@Deprecated
3336
public static final OrderedBlobVar ASCENDING = new OrderedBlobVar(Order.ASCENDING);
37+
/**
38+
* @deprecated since 3.0.0 and will be removed in 4.0.0
39+
*/
40+
@Deprecated
3441
public static final OrderedBlobVar DESCENDING = new OrderedBlobVar(Order.DESCENDING);
3542

36-
protected OrderedBlobVar(Order order) {
43+
public OrderedBlobVar(Order order) {
3744
super(order);
3845
}
3946

@@ -58,7 +65,13 @@ public int encode(PositionedByteRange dst, byte[] val) {
5865
}
5966

6067
/**
61-
* Write a subset of {@code val} to {@code buff}.
68+
* Write a subset of {@code val} to {@code dst}.
69+
*
70+
* @param dst the {@link PositionedByteRange} to write to
71+
* @param val the value to write to {@code dst}
72+
* @param voff the offset in {@code dst} where to write {@code val} to
73+
* @param vlen the lenght of {@code val}
74+
* @return the number of bytes written
6275
*/
6376
public int encode(PositionedByteRange dst, byte[] val, int voff, int vlen) {
6477
return OrderedBytes.encodeBlobVar(dst, val, voff, vlen, order);

hbase-common/src/main/java/org/apache/hadoop/hbase/types/OrderedBytesBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public abstract class OrderedBytesBase<T> implements DataType<T> {
3131

3232
protected final Order order;
3333

34-
protected OrderedBytesBase(Order order) {
34+
public OrderedBytesBase(Order order) {
3535
this.order = order;
3636
}
3737

hbase-common/src/main/java/org/apache/hadoop/hbase/types/OrderedFloat32.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,23 @@
2828
*/
2929
@InterfaceAudience.Public
3030
public class OrderedFloat32 extends OrderedBytesBase<Float> {
31-
31+
/**
32+
* @deprecated since 3.0.0 and will be removed in 4.0.0
33+
*/
34+
@Deprecated
3235
public static final OrderedFloat32 ASCENDING = new OrderedFloat32(Order.ASCENDING);
36+
/**
37+
* @deprecated since 3.0.0 and will be removed in 4.0.0
38+
*/
39+
@Deprecated
3340
public static final OrderedFloat32 DESCENDING = new OrderedFloat32(Order.DESCENDING);
3441

35-
protected OrderedFloat32(Order order) {
42+
/**
43+
* Creates a new 32-bit {@code float} with a fixed-length encoding.
44+
*
45+
* @param order the {@link Order} to use
46+
*/
47+
public OrderedFloat32(Order order) {
3648
super(order);
3749
}
3850

@@ -66,13 +78,20 @@ public int encode(PositionedByteRange dst, Float val) {
6678

6779
/**
6880
* Read a {@code float} value from the buffer {@code dst}.
81+
*
82+
* @param dst the {@link PositionedByteRange} to read the {@code float} from
83+
* @return the {@code float} read from the buffer
6984
*/
7085
public float decodeFloat(PositionedByteRange dst) {
7186
return OrderedBytes.decodeFloat32(dst);
7287
}
7388

7489
/**
7590
* Write instance {@code val} into buffer {@code buff}.
91+
*
92+
* @param dst the {@link PositionedByteRange} to write to
93+
* @param val the value to write to {@code dst}
94+
* @return the number of bytes written
7695
*/
7796
public int encodeFloat(PositionedByteRange dst, float val) {
7897
return OrderedBytes.encodeFloat32(dst, val, order);

hbase-common/src/main/java/org/apache/hadoop/hbase/types/OrderedFloat64.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,23 @@
2828
*/
2929
@InterfaceAudience.Public
3030
public class OrderedFloat64 extends OrderedBytesBase<Double> {
31-
31+
/**
32+
* @deprecated since 3.0.0 and will be removed in 4.0.0
33+
*/
34+
@Deprecated
3235
public static final OrderedFloat64 ASCENDING = new OrderedFloat64(Order.ASCENDING);
36+
/**
37+
* @deprecated since 3.0.0 and will be removed in 4.0.0
38+
*/
39+
@Deprecated
3340
public static final OrderedFloat64 DESCENDING = new OrderedFloat64(Order.DESCENDING);
3441

35-
protected OrderedFloat64(Order order) {
42+
/**
43+
* Creates a new 64-bite {@code double} with a fixed-length encoding.
44+
*
45+
* @param order the {@link Order} to use
46+
*/
47+
public OrderedFloat64(Order order) {
3648
super(order);
3749
}
3850

@@ -66,13 +78,20 @@ public int encode(PositionedByteRange dst, Double val) {
6678

6779
/**
6880
* Read a {@code double} value from the buffer {@code src}.
81+
*
82+
* @param src the {@link PositionedByteRange} to read the {@code double} from
83+
* @return the {@code double} floating-point value with the same bit pattern
6984
*/
7085
public double decodeDouble(PositionedByteRange src) {
7186
return OrderedBytes.decodeFloat64(src);
7287
}
7388

7489
/**
7590
* Write instance {@code val} into buffer {@code dst}.
91+
*
92+
* @param dst the {@link PositionedByteRange} to write to
93+
* @param val the value to write to {@code dst}
94+
* @return the number of bytes written
7695
*/
7796
public int encodeDouble(PositionedByteRange dst, double val) {
7897
return OrderedBytes.encodeFloat64(dst, val, order);

hbase-common/src/main/java/org/apache/hadoop/hbase/types/OrderedInt16.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,23 @@
2828
*/
2929
@InterfaceAudience.Public
3030
public class OrderedInt16 extends OrderedBytesBase<Short> {
31-
31+
/**
32+
* @deprecated since 3.0.0 and will be removed in 4.0.0
33+
*/
34+
@Deprecated
3235
public static final OrderedInt16 ASCENDING = new OrderedInt16(Order.ASCENDING);
36+
/**
37+
* @deprecated since 3.0.0 and will be removed in 4.0.0
38+
*/
39+
@Deprecated
3340
public static final OrderedInt16 DESCENDING = new OrderedInt16(Order.DESCENDING);
3441

35-
protected OrderedInt16(Order order) {
42+
/**
43+
* Creates a new 16-bit {@code short} with a fixed-length encoding.
44+
*
45+
* @param order the {@link Order} to use
46+
*/
47+
public OrderedInt16(Order order) {
3648
super(order);
3749
}
3850

@@ -66,13 +78,20 @@ public int encode(PositionedByteRange dst, Short val) {
6678

6779
/**
6880
* Read a {@code short} value from the buffer {@code src}.
81+
*
82+
* @param src the {@link PositionedByteRange} to read the {@code float} from
83+
* @return the {@code short} read from buffer
6984
*/
7085
public short decodeShort(PositionedByteRange src) {
7186
return OrderedBytes.decodeInt16(src);
7287
}
7388

7489
/**
7590
* Write instance {@code val} into buffer {@code dst}.
91+
*
92+
* @param dst the {@link PositionedByteRange} to write to
93+
* @param val the value to write to {@code dst}
94+
* @return the number of bytes written
7695
*/
7796
public int encodeShort(PositionedByteRange dst, short val) {
7897
return OrderedBytes.encodeInt16(dst, val, order);

hbase-common/src/main/java/org/apache/hadoop/hbase/types/OrderedInt32.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,23 @@
2828
*/
2929
@InterfaceAudience.Public
3030
public class OrderedInt32 extends OrderedBytesBase<Integer> {
31-
31+
/**
32+
* @deprecated since 3.0.0 and will be removed in 4.0.0
33+
*/
34+
@Deprecated
3235
public static final OrderedInt32 ASCENDING = new OrderedInt32(Order.ASCENDING);
36+
/**
37+
* @deprecated since 3.0.0 and will be removed in 4.0.0
38+
*/
39+
@Deprecated
3340
public static final OrderedInt32 DESCENDING = new OrderedInt32(Order.DESCENDING);
3441

35-
protected OrderedInt32(Order order) {
42+
/**
43+
* Creates a new 32-bit {@code int} with a fixed-length encoding.
44+
*
45+
* @param order the {@link Order} to use
46+
*/
47+
public OrderedInt32(Order order) {
3648
super(order);
3749
}
3850

@@ -66,13 +78,20 @@ public int encode(PositionedByteRange dst, Integer val) {
6678

6779
/**
6880
* Read an {@code int} value from the buffer {@code src}.
81+
*
82+
* @param src the {@link PositionedByteRange} to read the {@code int} from
83+
* @return the {@code int} read from the buffer
6984
*/
7085
public int decodeInt(PositionedByteRange src) {
7186
return OrderedBytes.decodeInt32(src);
7287
}
7388

7489
/**
7590
* Write instance {@code val} into buffer {@code dst}.
91+
*
92+
* @param dst the {@link PositionedByteRange} to write to
93+
* @param val the value to write to {@code dst}
94+
* @return the number of bytes written
7695
*/
7796
public int encodeInt(PositionedByteRange dst, int val) {
7897
return OrderedBytes.encodeInt32(dst, val, order);

hbase-common/src/main/java/org/apache/hadoop/hbase/types/OrderedInt64.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,23 @@
2828
*/
2929
@InterfaceAudience.Public
3030
public class OrderedInt64 extends OrderedBytesBase<Long> {
31-
31+
/**
32+
* @deprecated since 3.0.0 and will be removed in 4.0.0
33+
*/
34+
@Deprecated
3235
public static final OrderedInt64 ASCENDING = new OrderedInt64(Order.ASCENDING);
36+
/**
37+
* @deprecated since 3.0.0 and will be removed in 4.0.0
38+
*/
39+
@Deprecated
3340
public static final OrderedInt64 DESCENDING = new OrderedInt64(Order.DESCENDING);
3441

35-
protected OrderedInt64(Order order) {
42+
/**
43+
* Creates a new 64-bit {@code long} with a fixed-length encoding.
44+
*
45+
* @param order the {@link Order} to use
46+
*/
47+
public OrderedInt64(Order order) {
3648
super(order);
3749
}
3850

@@ -66,13 +78,20 @@ public int encode(PositionedByteRange dst, Long val) {
6678

6779
/**
6880
* Read a {@code long} value from the buffer {@code src}.
81+
*
82+
* @param src the {@link PositionedByteRange} to read the {@code long} from
83+
* @return the {@code long} read from the buffer
6984
*/
7085
public long decodeLong(PositionedByteRange src) {
7186
return OrderedBytes.decodeInt64(src);
7287
}
7388

7489
/**
7590
* Write instance {@code val} into buffer {@code dst}.
91+
*
92+
* @param dst the {@link PositionedByteRange} to write to
93+
* @param val the value to write to {@code dst}
94+
* @return the number of bytes written
7695
*/
7796
public int encodeLong(PositionedByteRange dst, long val) {
7897
return OrderedBytes.encodeInt64(dst, val, order);

hbase-common/src/main/java/org/apache/hadoop/hbase/types/OrderedInt8.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,23 @@
2828
*/
2929
@InterfaceAudience.Public
3030
public class OrderedInt8 extends OrderedBytesBase<Byte> {
31-
31+
/**
32+
* @deprecated since 3.0.0 and will be removed in 4.0.0
33+
*/
34+
@Deprecated
3235
public static final OrderedInt8 ASCENDING = new OrderedInt8(Order.ASCENDING);
36+
/**
37+
* @deprecated since 3.0.0 and will be removed in 4.0.0
38+
*/
39+
@Deprecated
3340
public static final OrderedInt8 DESCENDING = new OrderedInt8(Order.DESCENDING);
3441

35-
protected OrderedInt8(Order order) {
42+
/**
43+
* Creates a new 8-bit {@code byte} with a fixed-length encoding.
44+
*
45+
* @param order the {@link Order} to use
46+
*/
47+
public OrderedInt8(Order order) {
3648
super(order);
3749
}
3850

@@ -66,13 +78,20 @@ public int encode(PositionedByteRange dst, Byte val) {
6678

6779
/**
6880
* Read a {@code byte} value from the buffer {@code src}.
81+
*
82+
* @param src the {@link PositionedByteRange} to read the {@code byte} from
83+
* @return the {@code byte} read from the buffer
6984
*/
7085
public byte decodeByte(PositionedByteRange src) {
7186
return OrderedBytes.decodeInt8(src);
7287
}
7388

7489
/**
7590
* Write instance {@code val} into buffer {@code dst}.
91+
*
92+
* @param dst the {@link PositionedByteRange} to write to
93+
* @param val the value to write to {@code dst}
94+
* @return the number of bytes written
7695
*/
7796
public int encodeByte(PositionedByteRange dst, byte val) {
7897
return OrderedBytes.encodeInt8(dst, val, order);

0 commit comments

Comments
 (0)