Method from javax.management.openmbean.TabularType Detail: |
public boolean equals(Object obj) {
// if obj is null, return false
//
if (obj == null) {
return false;
}
// if obj is not a TabularType, return false
//
TabularType other;
try {
other = (TabularType) obj;
} catch (ClassCastException e) {
return false;
}
// Now, really test for equality between this TabularType instance and the other:
//
// their names should be equal
if ( ! this.getTypeName().equals(other.getTypeName()) ) {
return false;
}
// their row types should be equal
if ( ! this.rowType.equals(other.rowType) ) {
return false;
}
// their index names should be equal and in the same order (ensured by List.equals())
if ( ! this.indexNames.equals(other.indexNames) ) {
return false;
}
// All tests for equality were successfull
//
return true;
}
|
public List<String> getIndexNames() {
return indexNames;
}
Returns, in the same order as was given to this instance's
constructor, an unmodifiable List of the names of the items the
values of which are used to uniquely index each row element of
tabular data values described by this TabularType
instance.
|
public CompositeType getRowType() {
return rowType;
}
Returns the type of the row elements of tabular data values
described by this TabularType instance. |
public int hashCode() {
// Calculate the hash code value if it has not yet been done (ie 1st call to hashCode())
//
if (myHashCode == null) {
int value = 0;
value += this.getTypeName().hashCode();
value += this.rowType.hashCode();
for (String index : indexNames)
value += index.hashCode();
myHashCode = Integer.valueOf(value);
}
// return always the same hash code for this instance (immutable)
//
return myHashCode.intValue();
}
Returns the hash code value for this TabularType instance.
The hash code of a TabularType instance is the sum of the hash codes
of all elements of information used in equals comparisons
(ie: name, row type, index names).
This ensures that t1.equals(t2) implies that t1.hashCode()==t2.hashCode()
for any two TabularType instances t1 and t2 ,
as required by the general contract of the method
Object.hashCode() .
As TabularType instances are immutable, the hash code for this instance is calculated once,
on the first call to hashCode , and then the same value is returned for subsequent calls. |
boolean isAssignableFrom(OpenType<?> ot) {
if (!(ot instanceof TabularType))
return false;
TabularType tt = (TabularType) ot;
if (!getTypeName().equals(tt.getTypeName()) ||
!getIndexNames().equals(tt.getIndexNames()))
return false;
return getRowType().isAssignableFrom(tt.getRowType());
}
|
public boolean isValue(Object obj) {
// if obj is null or not a TabularData, return false
//
if (!(obj instanceof TabularData))
return false;
// if obj is not a TabularData, return false
//
TabularData value = (TabularData) obj;
TabularType valueType = value.getTabularType();
return isAssignableFrom(valueType);
}
Tests whether obj is a value which could be
described by this TabularType instance.
If obj is null or is not an instance of
javax.management.openmbean.TabularData ,
isValue returns false .
If obj is an instance of
javax.management.openmbean.TabularData , say {@code
td}, the result is true if this {@code TabularType} is
assignable from td.getTabularType() , as defined in CompositeType.isValue . |
public String toString() {
// Calculate the string representation if it has not yet been done (ie 1st call to toString())
//
if (myToString == null) {
final StringBuilder result = new StringBuilder()
.append(this.getClass().getName())
.append("(name=")
.append(getTypeName())
.append(",rowType=")
.append(rowType.toString())
.append(",indexNames=(");
String sep = "";
for (String index : indexNames) {
result.append(sep).append(index);
sep = ",";
}
result.append("))");
myToString = result.toString();
}
// return always the same string representation for this instance (immutable)
//
return myToString;
}
Returns a string representation of this TabularType instance.
The string representation consists of the name of this class (ie javax.management.openmbean.TabularType ),
the type name for this instance, the row type string representation of this instance,
and the index names of this instance.
As TabularType instances are immutable, the string representation for this instance is calculated once,
on the first call to toString , and then the same value is returned for subsequent calls. |