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

public abstract class AbstractEntry extends Object implements Entry
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
    Modifier
    Constructor
    Description
    protected
    Creates an instance of this class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Object other)
    Compares this AbstractEntry to the specified object.
    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.
    int
    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.
    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.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • AbstractEntry

      protected AbstractEntry()
      Creates an instance of this class.
  • Method Details

    • equals

      public boolean equals(Object other)
      Compares this 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).
      Overrides:
      equals in class Object
      Parameters:
      other - the object to compare this AbstractEntry against
      Returns:
      true if this object is equivalent to other and false otherwise
    • equals

      public 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. Will also return true if both arguments are null. In all other cases an invocation of this method will return false.

      Parameters:
      e1 - an entry object to compare to e2
      e2 - an entry object to compare to e1
      Returns:
      true if the two arguments are equivalent
    • hashCode

      public int hashCode()
      Returns the result of calling AbstractEntry.hashCode(this).
      Overrides:
      hashCode in class Object
      Returns:
      the result of calling AbstractEntry.hashCode(this)
    • hashCode

      public static int hashCode(Entry entry)
      Returns zero XORed with the result of invoking hashCode on each of the argument's non-null entry fields. Returns 0 if the argument is null.
      Parameters:
      entry - the Entry for which to generate a hash code
      Returns:
      a hash code formed by XORing the hash codes of entry's non-null entry field, or 0 if entry is null
    • toString

      public String toString()
      Returns the result of calling AbstractEntry.toString(this).
      Overrides:
      toString in class Object
      Returns:
      the result of calling AbstractEntry.toString(this)
    • toString

      public 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. 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".

      Parameters:
      entry - an entry to represent as a String
      Returns:
      a String representation of entry that contains the name of the entry's class and a representation of each of entry's entry fields