org.eclipse.palamedes.gdl.core.model.utils
Class AbstractFactory

java.lang.Object
  extended by org.eclipse.palamedes.gdl.core.model.utils.AbstractFactory
Direct Known Subclasses:
GameFactory, StrategyFactory

public abstract class AbstractFactory
extends java.lang.Object

The AbstractFactory class is the base class for all factories within Palamedes. It provides the management of descriptions for external classes.


Nested Class Summary
 class AbstractFactory.FactoryDescription
          Container class for descriptions of classes to be used by any factory.
 
Field Summary
protected  java.util.List<AbstractFactory.FactoryDescription> descriptions
          Internal list of all class descriptions
 
Constructor Summary
AbstractFactory()
           
 
Method Summary
 void addDescription(AbstractFactory.FactoryDescription description)
          This method adds the given description to the factory.
 void addDescription(java.lang.String name, java.lang.String className, java.lang.String description)
          This method uses the given parameter to create a FactoryDescription object which then will be added to the factory.
protected  java.lang.Object createInstance(AbstractFactory.FactoryDescription description)
          This method creates an instance of a class based on the given description.
protected  java.lang.Object createInstance(java.lang.String className)
          This method creates an instance of a class based on the given class name.
protected  AbstractFactory.FactoryDescription getDescriptionByName(java.lang.String name)
          This method returns the description with name \a name.
 java.util.List<AbstractFactory.FactoryDescription> getDescriptions()
          This method returns the description list of the factory.
 void removeDescription(AbstractFactory.FactoryDescription description)
          This method removes the given description from the factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

descriptions

protected java.util.List<AbstractFactory.FactoryDescription> descriptions
Internal list of all class descriptions

Constructor Detail

AbstractFactory

public AbstractFactory()
Method Detail

addDescription

public void addDescription(AbstractFactory.FactoryDescription description)
This method adds the given description to the factory.

Parameters:
description -

addDescription

public void addDescription(java.lang.String name,
                           java.lang.String className,
                           java.lang.String description)
This method uses the given parameter to create a FactoryDescription object which then will be added to the factory.

Parameters:
name -
className -
description -

removeDescription

public void removeDescription(AbstractFactory.FactoryDescription description)
This method removes the given description from the factory.

Parameters:
description -

getDescriptions

public java.util.List<AbstractFactory.FactoryDescription> getDescriptions()
This method returns the description list of the factory.


createInstance

protected java.lang.Object createInstance(AbstractFactory.FactoryDescription description)
This method creates an instance of a class based on the given description. This method is meant to be used by inherited classes and should not be public.

Parameters:
description -

createInstance

protected java.lang.Object createInstance(java.lang.String className)
This method creates an instance of a class based on the given class name. This method is meant to be used by inherited classes and should not be public.

Parameters:
className -

getDescriptionByName

protected AbstractFactory.FactoryDescription getDescriptionByName(java.lang.String name)
This method returns the description with name \a name.

Parameters:
name -