Class Extend

  extended by com.perisic.shadow.example.mains.Extend

public class Extend
extends java.lang.Object

This example shows how a shadow can be used to to extend the functionality of a class. The class NiceFellow is shadowed by a CalamityShadow providing extra behaviour (tell calamity, crying). Note that the shadow also applies to the child NiceChild of NiceFellow. In addition we have shadowed the fabian object by a SmileShadow. Note that the SmileShadow has no effect on Tomislav's behaviour. This is the (uncommented) code of this class:

public class Extend {

 public static void main(String [] args) {
       NiceFellow.addShadow(NiceFellow.class, CalamityShadow.class);

       NiceFellow fabian = new NiceFellow("Fabian");
       NiceChild tomislav = new NiceChild("Tomislav");

       fabian.addShadow(new SmileShadow());"smile",1);"printMood");"printMood");

       System.out.println("");"tellJokeTo", tomislav );
       tomislav.printMood();"tellCalamityTo", tomislav );"cry");

Constructor Summary
Method Summary
static void main(java.lang.String[] args)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public Extend()
Method Detail


public static void main(java.lang.String[] args)