Package net.jini.entry
Class AbstractEntry
java.lang.Object
net.jini.entry.AbstractEntry
- All Implemented Interfaces:
Serializable,Entry
- Direct Known Subclasses:
Comment,EventDescriptor,GenericEntry,JMXConnection,JoinState,Name,ServiceInfo,ServiceType,Status
An abstract implementation of
Entry that provides useful implementations of
equals, hashCode, and toString. Implementations of the
Entry interface may, but are not required to, extend this class.
The methods of this class consult the entry fields of the entries they process. The
entry fields of an Entry are its public, non-primitive, non-static, non-transient,
non-final fields.
- Author:
- Sun Microsystems, Inc.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares thisAbstractEntryto the specified object.static booleanReturnstrueif the two arguments are of the same class and for each entry field F, the arguments' values for F are either bothnullor the invocation ofequalson one argument's value for F with the other argument's value for F as its parameter returnstrue.inthashCode()Returns the result of callingAbstractEntry.hashCode(this).static intReturns zero XORed with the result of invokinghashCodeon each of the argument's non-nullentry fields.toString()Returns the result of callingAbstractEntry.toString(this).static StringReturns aStringrepresentation of its argument that will contain the name of the argument's class and a representation of each of the argument's entry fields.
-
Constructor Details
-
AbstractEntry
protected AbstractEntry()Creates an instance of this class.
-
-
Method Details
-
equals
Compares thisAbstractEntryto the specified object. Ifotherisnullor not an instance ofEntryreturnsfalse, otherwise returns the result of callingAbstractEntry.equals(this, (Entry) other). -
equals
Returnstrueif the two arguments are of the same class and for each entry field F, the arguments' values for F are either bothnullor the invocation ofequalson one argument's value for F with the other argument's value for F as its parameter returnstrue. Will also returntrueif both arguments arenull. In all other cases an invocation of this method will returnfalse.- Parameters:
e1- an entry object to compare to e2e2- an entry object to compare to e1- Returns:
trueif the two arguments are equivalent
-
hashCode
public int hashCode()Returns the result of callingAbstractEntry.hashCode(this).- Overrides:
hashCodein classObject- Returns:
- the result of calling
AbstractEntry.hashCode(this)
-
hashCode
Returns zero XORed with the result of invokinghashCodeon each of the argument's non-nullentry fields. Returns0if the argument isnull.- Parameters:
entry- theEntryfor which to generate a hash code- Returns:
- a hash code formed by XORing the hash codes of
entry's non-nullentry field, or0ifentryisnull
-
toString
Returns the result of callingAbstractEntry.toString(this).- Overrides:
toStringin classObject- Returns:
- the result of calling
AbstractEntry.toString(this)
-
toString
Returns aStringrepresentation of its argument that will contain the name of the argument's class and a representation of each of the argument's entry fields. The representation of each entry field will include the field's name and a representation of its value. If passednullwill return the string"null".- Parameters:
entry- an entry to represent as a String- Returns:
- a
Stringrepresentation ofentrythat contains the name of theentry's class and a representation of each ofentry's entry fields
-