org.pietschy.command

Class AbstractReflectionIconFactory

Implemented Interfaces:
IconFactory
Known Direct Subclasses:
MyAbstractReflectionIconFactory

public abstract class AbstractReflectionIconFactory
extends java.lang.Object
implements IconFactory

This implementation provides the basic infrastructure for translating the icon values to method calls. Subclasses must implement a method for every method type specified by the configuration files.

For example, a configuration of

   <icon type="icon-factory">createColoredIcon(200,127,127)<icon>
will result in a reflective call to the method
   public Icon createColoredIcon(String s1, String s2, String s3)
on the subclass.
See Also:
CommandManager.setIconFactory(IconFactory)

Method Summary

Icon
createIcon(String iconValue)
Converts the the iconValue into a method call on this class.

Method Details

createIcon

public Icon createIcon(String iconValue)
            throws Exception
Converts the the iconValue into a method call on this class.

For example, a configuration of

   <icon type="icon-factory">createColoredIcon(200,127,127)<icon>
will result in a reflective call to the method
   public Icon createColoredIcon(String s1, String s2, String s3)
on the subclass.
Specified by:
createIcon in interface IconFactory
Parameters:
iconValue - the icon text specified in the configuration file which will be interpreted as a method call on the subclass.
Returns:
an Icon created by the method specified in iconValue.