Code cleanup

This commit is contained in:
hns 2009-11-25 13:22:07 +00:00
parent 36c1557c99
commit 291e00bc6c

View file

@ -38,7 +38,9 @@ public final class SyntheticKey implements Key, Serializable {
static final long serialVersionUID = -693454133259421857L; static final long serialVersionUID = -693454133259421857L;
/** /**
* make a key for a persistent Object, describing its datasource and id. * Make a symbolic key for an object using its parent key and its property name/id.
* @param key the parent key
* @param name the property or collection name
*/ */
public SyntheticKey(Key key, String name) { public SyntheticKey(Key key, String name) {
this.parentKey = key; this.parentKey = key;
@ -46,31 +48,28 @@ public final class SyntheticKey implements Key, Serializable {
} }
/** /**
* * Returns true if this key equals obj
* * @param obj another object
* @param what ... * @return true if obj represents the same key as this
*
* @return ...
*/ */
public boolean equals(Object what) { public boolean equals(Object obj) {
if (what == this) { if (obj == this) {
return true; return true;
} }
if (!(what instanceof SyntheticKey)) { if (!(obj instanceof SyntheticKey)) {
return false; return false;
} }
SyntheticKey k = (SyntheticKey) what; SyntheticKey k = (SyntheticKey) obj;
return parentKey.equals(k.parentKey) && return parentKey.equals(k.parentKey) &&
((name == k.name) || name.equalsIgnoreCase(k.name)); ((name == k.name) || name.equalsIgnoreCase(k.name));
} }
/** /**
* * Get the hash-code for this key
* * @return the hash-code
* @return ...
*/ */
public int hashCode() { public int hashCode() {
if (hashcode == 0) { if (hashcode == 0) {
@ -82,36 +81,32 @@ public final class SyntheticKey implements Key, Serializable {
} }
/** /**
* * Get the parent key part of this key
* * @return the parent key
* @return ...
*/ */
public Key getParentKey() { public Key getParentKey() {
return parentKey; return parentKey;
} }
/** /**
* * Get the ID part of this key
* * @return the id part
* @return ...
*/ */
public String getID() { public String getID() {
return name; return name;
} }
/** /**
* * Get the storage name for this key. This alwys returns null for symbolic keys.
* * @return null
* @return ...
*/ */
public String getStorageName() { public String getStorageName() {
return null; return null;
} }
/** /**
* * Return a string representation for this key
* * @return a string representation for this key
* @return ...
*/ */
public String toString() { public String toString() {
return parentKey + "/" + name; return parentKey + "/" + name;