com.mucommander.ui.action
Class ActionDescriptor

java.lang.Object
  extended by com.mucommander.ui.action.ActionDescriptor

public class ActionDescriptor
extends java.lang.Object

A descriptor class for MuAction instances. An ActionDescriptor is the combination of a MuAction class (a class extending MuAction and following its conventions) and a set of properties used for instanciation. Thus, it not only identifies an action class but also the way it is instanciated.

Two ActionDescriptor instances are equal only if:

This means that two ActionDescriptor instances referring to the same MuAction class but with a different set of initialization properties will not be equal.

This class is used by ActionManager to instance MuAction and allow several instances to live in memory only if they have different initialization properties, which translated into action speak means a different appearance and/or behavior.

Author:
Maxence Bernard
See Also:
ActionManager, MuAction

Constructor Summary
ActionDescriptor(java.lang.Class actionClass)
          Convenience constructor which has the same effect as calling ActionDescriptor(Class, Hashtable) with a null value for the properties parameter.
ActionDescriptor(java.lang.Class muActionClass, java.util.Hashtable initProperties)
          Creates a new ActionDescriptor which identifies the specified combination of MuAction class and initialization properties.
 
Method Summary
 boolean equals(java.lang.Object o)
          Returns true if the given object is an ActionDescriptor that is equal to this one.
 java.lang.Class getActionClass()
          Returns a Class instance referring to a class that extends MuAction.
 java.util.Hashtable getInitProperties()
          Returns the list of properties that are to be used to instanciate the MuAction class, or null if there are none.
 int hashCode()
          Returns a hash code value for this ActionDescriptor, making this class suitable for use as a key in a Hashtable.
 java.lang.String toString()
          Returns a String representation of this ActionDescriptor.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ActionDescriptor

public ActionDescriptor(java.lang.Class actionClass)
Convenience constructor which has the same effect as calling ActionDescriptor(Class, Hashtable) with a null value for the properties parameter.

Parameters:
actionClass - a MuAction Class descriptor

ActionDescriptor

public ActionDescriptor(java.lang.Class muActionClass,
                        java.util.Hashtable initProperties)
Creates a new ActionDescriptor which identifies the specified combination of MuAction class and initialization properties. The properties parameter may be null if the action class is to be instanciated without any initialization properties.

The specified Class *must* denote a class that extends MuAction and follows its conventions (provide the proper constructor), otherwise ActionManager will fail to instanciate it. However, ActionDescriptor does not check if the specified Class is valid or not.

Parameters:
muActionClass - a MuAction Class descriptor
initProperties - a Hashtable containing the properties that will be used to instanciate the specified MuAction class
Method Detail

getActionClass

public java.lang.Class getActionClass()
Returns a Class instance referring to a class that extends MuAction.


getInitProperties

public java.util.Hashtable getInitProperties()
Returns the list of properties that are to be used to instanciate the MuAction class, or null if there are none.


equals

public boolean equals(java.lang.Object o)
Returns true if the given object is an ActionDescriptor that is equal to this one. ActionDescriptor instances are considered equal if they refer to the same MuAction class and set of initialization properties.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Returns a hash code value for this ActionDescriptor, making this class suitable for use as a key in a Hashtable.

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Returns a String representation of this ActionDescriptor.

Overrides:
toString in class java.lang.Object


This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard