|
|||||||||
| Home >> All >> docs >> [ template overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
docs.template
Class Example

java.lang.Objectdocs.template.Example
- All Implemented Interfaces:
- java.lang.Cloneable
- class Example
- extends java.lang.Object
- implements java.lang.Cloneable
- extends java.lang.Object
The point of base is that it contains some example implementations of code that is commonly written, and often done incorrectly.
|
Distribution Licence: Project B is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The License is available on the internet here, by writing to Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, Or locally at the Licence link below. The copyright to this program is held by it's authors. |
- Version:
- D8.I8.T0
| Field Summary | |
private Example |
data
Example member, used in the clone example |
| Constructor Summary | |
(package private) |
Example()
|
| Method Summary | |
java.lang.Object |
clone()
Get a copy of ourselves. |
boolean |
equals(java.lang.Object obj)
Is this Object equal to us. |
protected void |
finalize()
Clean up after ourselves. |
int |
hashCode()
Get a moderately unique id for this Object. |
java.lang.String |
toString()
Get a sting representation of this object. |
| Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
data
private Example data
- Example member, used in the clone example
| Constructor Detail |
Example
Example()
| Method Detail |
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
- Get a copy of ourselves. Points to note:
Call clone() not new() on member Objects, and on us.
Do not use Copy Constructors! - they do not inherit well.
Think about this needing to be synchronized
If this is not cloneable then writing cloneable children is harder
equals
public boolean equals(java.lang.Object obj)
- Is this Object equal to us. Points to note:
If you override equals(), you must override hashCode() too.
If you are doing this it is a good idea to be immutable.
hashCode
public int hashCode()
- Get a moderately unique id for this Object. Points to note:
JDK1.x - hashCode should not change for an Object.
JDK2.0 - hashCode may change if it's data changes
If you override hashCode(), you must override equals() too.
If you are doing this it is a good idea to be immutable.
toString
public java.lang.String toString()
- Get a sting representation of this object. Points to note:
Think about inheritance when using string names.
finalize
protected void finalize()
throws java.lang.Throwable
- Clean up after ourselves. Points to note:
There is no garantee that this will be called
Call the superclasses filalize()
|
|||||||||
| Home >> All >> docs >> [ template overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
docs.template.Example