Package be.gaudry.model
Class AbstractLightObject
java.lang.Object
be.gaudry.model.AbstractLightObject
- All Implemented Interfaces:
ILightObject
,Serializable
- Direct Known Subclasses:
LightObject
,Meter
,Period
,Person
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
-
Field Summary
Fields inherited from interface be.gaudry.model.ILightObject
DEFAULT_ID
-
Constructor Summary
ConstructorDescriptionBuilds an instance with aILightObject.DEFAULT_ID
and "?" as displayAbstractLightObject(int id, String display)
Builds an instance with an id and a display -
Method Summary
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface be.gaudry.model.ILightObject
getDisplay, getId, setDisplay, setId
-
Constructor Details
-
AbstractLightObject
public AbstractLightObject()Builds an instance with aILightObject.DEFAULT_ID
and "?" as display -
AbstractLightObject
Builds an instance with an id and a display- Parameters:
id
- identifier of the LightObjectdisplay
- representation of the LightObject
-
-
Method Details
-
equals
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 classObject
- 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 classObject
- Returns:
- a hash code value for this LightObject.
- See Also:
equals(Object)
-
toString
Builds a string with variables values and the class.- Overrides:
toString
in classObject
- Returns:
- a String representation of this LightObject only for debugging
- See Also:
Object.toString()
-