Class AbstractLightObject

java.lang.Object
be.gaudry.model.AbstractLightObject
All Implemented Interfaces:
ILightObject, Serializable
Direct Known Subclasses:
LightObject, Meter, Period, Person

public abstract class AbstractLightObject extends Object implements ILightObject, Serializable
Basic implementation of the ILightObject. \nThis does not implement id and display features, to delegate work to the concrete class, but provides a basic implementation of equals(Object) and hashCode(). Provided by the broldev.core.model project.
Since:
1.0 (Nov 27, 2007), broldev.core.model 0.0.1-SNAPSHOT dependency
Version:
1.0 (Nov 27, 2007)
Author:
Steph GAUDRY
See Also:
Serialized Form
  • Constructor Details

    • AbstractLightObject

      public AbstractLightObject()
      Builds an instance with a ILightObject.DEFAULT_ID and "?" as display
    • AbstractLightObject

      public AbstractLightObject(int id, String display)
      Builds an instance with an id and a display
      Parameters:
      id - identifier of the LightObject
      display - representation of the LightObject
  • Method Details

    • equals

      public boolean equals(Object obj)
      Indicates whether some other object is "equal to" this LightObject.
      Check is done on following fields :
      • id
      • getDisplay method (Use getDisplay instead of display because getDisplay may be override in child class, and display field may be null).
      Overrides:
      equals in class Object
      Parameters:
      obj - the reference object with which to compare.
      Returns:
      true if this LightObject is the same as the obj argument; false otherwise.
      See Also:
      hashCode()
    • hashCode

      public int hashCode()
      Returns a hash code value for this LightObject.
      Hash is done on following fields :
      • id
      • ILightObject.getDisplay() method if not null (Use getDisplay instead of display because getDisplay may be override in child class, and display field may be null).
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this LightObject.
      See Also:
      equals(Object)
    • toString

      public String toString()
      Builds a string with variables values and the class.
      Overrides:
      toString in class Object
      Returns:
      a String representation of this LightObject only for debugging
      See Also:
      Object.toString()