Improve AttributeKey.toString()
This commit is contained in:
parent
08137e2c49
commit
91c02c2823
|
@ -12,6 +12,7 @@ public final class AttributeKey<T> implements Serializable, Comparable<Attribute
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final Class<T> valueType;
|
private final Class<T> valueType;
|
||||||
|
private final String strVal;
|
||||||
|
|
||||||
public AttributeKey(String name, Class<T> valueType) {
|
public AttributeKey(String name, Class<T> valueType) {
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
|
@ -27,6 +28,7 @@ public final class AttributeKey<T> implements Serializable, Comparable<Attribute
|
||||||
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.valueType = valueType;
|
this.valueType = valueType;
|
||||||
|
strVal = name + '[' + valueType.getSimpleName() + ']';
|
||||||
}
|
}
|
||||||
|
|
||||||
public String name() {
|
public String name() {
|
||||||
|
@ -37,16 +39,6 @@ public final class AttributeKey<T> implements Serializable, Comparable<Attribute
|
||||||
return valueType;
|
return valueType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return System.identityHashCode(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
return this == o;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(AttributeKey<T> o) {
|
public int compareTo(AttributeKey<T> o) {
|
||||||
return name().compareTo(o.name());
|
return name().compareTo(o.name());
|
||||||
|
@ -54,6 +46,6 @@ public final class AttributeKey<T> implements Serializable, Comparable<Attribute
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name();
|
return strVal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user