You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/02/26 14:43:04 UTC

[GitHub] tillrohrmann commented on a change in pull request #7825: [FLINK-11744] Provide stable/final toHexString for AbstractID

tillrohrmann commented on a change in pull request #7825: [FLINK-11744]  Provide stable/final toHexString for AbstractID
URL: https://github.com/apache/flink/pull/7825#discussion_r260314938
 
 

 ##########
 File path: flink-core/src/main/java/org/apache/flink/util/AbstractID.java
 ##########
 @@ -127,6 +127,22 @@ public long getUpperPart() {
 		return bytes;
 	}
 
+	/**
+	 * Returns pure String representation of the ID in hexadecimal. This method should be used to construct things like
+	 * paths etc., that require a stable representation and is therefore final.
+	 */
+	public final String toHexString() {
+		if (this.toString == null) {
+			final byte[] ba = new byte[SIZE];
+			longToByteArray(this.lowerPart, ba, 0);
+			longToByteArray(this.upperPart, ba, SIZE_OF_LONG);
+
+			this.toString = StringUtils.byteToHexString(ba);
+		}
+
+		return this.toString;
 
 Review comment:
   Let's rename `this.toString` to `this.hexString`.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services