[Webfunds-commits] java/webfunds/sox Id.java
Jeroen C. van Gelderen
gelderen@cypherpunks.ai
Tue, 20 Feb 2001 17:53:10 -0400 (AST)
gelderen 01/02/20 17:53:10
Modified: webfunds/sox Id.java
Log:
- Add replacements for the misnamed [get|set]Id methods, named getByteArray
and setByteArray. Mark the old versions deprecated.
- Drop Serializable as it seems to be unused.
- Tweak some comments.
Revision Changes Path
1.7 +31 -6 java/webfunds/sox/Id.java
Index: Id.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/Id.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Id.java 2000/08/05 13:00:56 1.6
+++ Id.java 2001/02/20 21:53:10 1.7
@@ -1,5 +1,5 @@
/*
- * $Id: Id.java,v 1.6 2000/08/05 13:00:56 iang Exp $
+ * $Id: Id.java,v 1.7 2001/02/20 21:53:10 gelderen Exp $
*
* Copyright (c) Systemics Ltd 1995-1999 on behalf of
* the WebFunds Development Team. All Rights Reserved.
@@ -13,23 +13,48 @@
* This class represents an identifer, which can refer to
* an object by means of a hash or similar.
* This is a pseudo abstract class for other identifier classes.
+ *
+ * @version $Revision: 1.7 $
*/
-public class Id
+public /*abstract*/ class Id extends Encodable
// should be abstract but this makes the test harder
- extends Encodable implements Serializable
{
/**
* The item identifier.
*/
protected byte[] id;
+
/**
- * Assign a new identifier.
+ * Get the underlying byte[]. You should probably not be using this but
+ * pass the whole Id object around instead.
*/
- public void setId(byte[] id) { this.id = id; }
- public byte[] getId() { return id; }
+ public byte[] getByteArray() {
+ return id;
+ }
+
+
+ /**
+ * Set the underlying byte[].
+ *
+ * XXX: Id should probably become immutable.
+ */
+ public void setByteArray(byte[] byteArray) {
+ this.id = byteArray;
+ }
+ /**
+ * @deprecated Misnamed, confusing name. An Id is an Id, not a byte[].
+ * Use setByteArray() instead.
+ */
+ public void setId(byte[] id) { this.id = id; }
+
+ /**
+ * @deprecated Misnamed, confusing name. An Id is an Id, not a byte[].
+ * Use getByteArray() instead.
+ */
+ public byte[] getId() { return id; }
////// Construction ///////////////////////////////////