home *** CD-ROM | disk | FTP | other *** search
- package com.commerceone.util.identity;
-
- public class StringIdentity implements Identity {
- private final String m_identity;
-
- public String toString() {
- return this.m_identity;
- }
-
- public int hashCode() {
- return this.m_identity.hashCode();
- }
-
- public StringIdentity(String identity) {
- this.m_identity = identity;
- }
-
- public boolean equals(Object obj) {
- return !(obj instanceof StringIdentity) ? false : this.m_identity.equals(obj.toString());
- }
-
- public byte[] toBytes() {
- byte[] bytes = new byte[this.m_identity.length() * 2];
-
- for(int i = 0; i < this.m_identity.length(); ++i) {
- byte lowbyte = (byte)(this.m_identity.charAt(i) & 255);
- int highbyteI = this.m_identity.charAt(i) & 255;
- highbyteI <<= 8;
- byte highbyte = (byte)highbyteI;
- bytes[i * 2] = lowbyte;
- bytes[i * 2 + 1] = highbyte;
- }
-
- return bytes;
- }
-
- public int formatHint() {
- return 0;
- }
- }
-