com.perisic.shadow.example.lib
Class NiceFellow

java.lang.Object
  extended by com.perisic.shadow.Shadowable
      extended by com.perisic.shadow.example.lib.NiceFellow
Direct Known Subclasses:
NiceChild

public class NiceFellow
extends Shadowable

A simple example of a Java class that can be shadowed.


Constructor Summary
NiceFellow(java.lang.String theName)
          Consruction by name.
 
Method Summary
 java.lang.Integer getHappyness()
          Accessor method for happyness attribute.
 java.lang.String getName()
          Accessor method for name.
 void printMood()
          Prints either that the nice fellow feels happy or sad, depending if happyness is greater then 0.
 void setHappyness(java.lang.Integer h)
          Modifier method for happyness attribute.
 void smile(java.lang.Integer howmuch)
          Smiling increases the happyness by howmuch.
 void tellJokeTo(NiceFellow other)
          Makes the other smile.
 
Methods inherited from class com.perisic.shadow.Shadowable
addShadow, addShadow, allShadowedClasses, call, getClassShadows, getShadows, removeShadow, removeShadow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NiceFellow

public NiceFellow(java.lang.String theName)
Consruction by name. By default the nice fellow is not happy (=0).

Parameters:
theName - The name of the nice fellow.
Method Detail

setHappyness

public void setHappyness(java.lang.Integer h)
Modifier method for happyness attribute.

Parameters:
h - The amount of happyness.

getHappyness

public java.lang.Integer getHappyness()
Accessor method for happyness attribute.

Returns:
How happy the nice fellow is.

getName

public java.lang.String getName()
Accessor method for name. Name is an imutable attribute, it declared in the constructor.


smile

public void smile(java.lang.Integer howmuch)
Smiling increases the happyness by howmuch. A message is printed that the nice fellow smiles.

Parameters:
howmuch - How much the happyness will be increased.

printMood

public void printMood()
Prints either that the nice fellow feels happy or sad, depending if happyness is greater then 0.


tellJokeTo

public void tellJokeTo(NiceFellow other)
Makes the other smile. Prints a short message.

Parameters:
other - The one who gets the joke told.