public abstract class AbstractEntry extends Object implements Entry
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.
Entry
,
Serialized FormModifier | Constructor and Description |
---|---|
protected |
AbstractEntry()
Creates an instance of this class.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
equals(Entry e1,
Entry e2)
Returns
true if the two arguments are of the same
class and for each entry field F, the arguments'
values for F are either both null or the
invocation of equals on one argument's value for
F with the other argument's value for F as
its parameter returns true . |
boolean |
equals(Object other)
Compares this
AbstractEntry to the specified
object. |
int |
hashCode()
Returns the result of calling
AbstractEntry.hashCode(this) . |
static int |
hashCode(Entry entry)
Returns zero XORed with the result of invoking
hashCode on each of the argument's
non-null entry fields. |
String |
toString()
Returns the result of calling
AbstractEntry.toString(this) . |
static String |
toString(Entry entry)
Returns a
String representation of its argument
that will contain the name of the argument's class and a
representation of each of the argument's entry fields. |
public boolean equals(Object other)
AbstractEntry
to the specified
object. If other
is null
or not an
instance of Entry
returns false
,
otherwise returns the result of calling AbstractEntry.equals(this, (Entry) other)
.public static boolean equals(Entry e1, Entry e2)
true
if the two arguments are of the same
class and for each entry field F, the arguments'
values for F are either both null
or the
invocation of equals
on one argument's value for
F with the other argument's value for F as
its parameter returns true
. Will also return
true
if both arguments are null
. In
all other cases an invocation of this method will return
false
.e1
- an entry object to compare to e2e2
- an entry object to compare to e1true
if the two arguments are equivalentpublic int hashCode()
AbstractEntry.hashCode(this)
.hashCode
in class Object
AbstractEntry.hashCode(this)
public static int hashCode(Entry entry)
hashCode
on each of the argument's
non-null
entry fields. Returns 0
if
the argument is null
.entry
- the Entry
for which to generate a
hash codeentry
's non-null
entry field,
or 0
if entry
is
null
public String toString()
AbstractEntry.toString(this)
.toString
in class Object
AbstractEntry.toString(this)
public static String toString(Entry entry)
String
representation 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 passed
null
will return the string "null"
. entry
- an entry to represent as a StringString
representation of
entry
that contains the name of the
entry
's class and a representation of each
of entry
's entry fields