Package marauroa.server.game.rp
Class RPObjectFactory
java.lang.Object
marauroa.server.game.rp.RPObjectFactory
- Direct Known Subclasses:
StendhalRPObjectFactory
This class is a factory to convert RPObjects into real objects for your game.
This class is invoked by whatever that load an object into the server:
- JDBCDatabase.
To make it work on your game you need to subclass and implement:
static RPObjectFactory getFactory()
The method will be called through refletions.
- Author:
- miguel
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic RPObjectFactory
get()
This method returns an instance of RPObjectFactory choosen using the Configuration file.static RPObjectFactory
This method returns an instance of RPObjectFactory chosen using the param.static RPObjectFactory
gets the ObjectFactory, creating a default one in case it does not exist alreadyThis method is called when object is serialized back from database to zone, so you can define which subclass of RPObject we are going to use.
-
Constructor Details
-
RPObjectFactory
public RPObjectFactory()
-
-
Method Details
-
get
This method returns an instance of RPObjectFactory choosen using the Configuration file.- Returns:
- A shared instance of RPObjectFactory
- Throws:
NoFactoryConfException
- if the factory is not configured correctly
-
get
This method returns an instance of RPObjectFactory chosen using the param.- Parameters:
factoryName
- A String containing the type of factory. It should be the complete class name. ie: marauroa.server.game.rp.RPObjectFactory- Returns:
- A shared instance of RPObjectFactory
- Throws:
NoFactoryConfException
- if the factory is not configured correctly
-
getFactory
gets the ObjectFactory, creating a default one in case it does not exist already- Returns:
- RPObjectFactory
-
transform
This method is called when object is serialized back from database to zone, so you can define which subclass of RPObject we are going to use. This implements a factory pattern. If you are not interested in this feature, just return the object- Parameters:
object
- the original object- Returns:
- the new instance of the object
-