public abstract class AbstractEntry extends Object implements CloneableEntry
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 Form| Modifier | Constructor and Description |
|---|---|
protected |
AbstractEntry()
Creates an instance of this class.
|
| Modifier and Type | Method and Description |
|---|---|
Entry |
clone()
Clone has been implemented to allow utilities such as
ServiceDiscoveryManager to avoid sharing
internally stored instances with client code. |
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 Entry clone()
ServiceDiscoveryManager to avoid sharing
internally stored instances with client code.
Entry's that have mutable fields, for example arrays or collections,
should override this method, call super.clone(), then safely copy
any mutable fields before returning.clone in interface CloneableEntryclone in class Objectpublic 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 ObjectAbstractEntry.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
nullpublic String toString()
AbstractEntry.toString(this).toString in class ObjectAbstractEntry.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 fieldsCopyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.