|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.bluesock.bluemud.driver.ObjectFactory
The ObjectFactory is responsible for the creation of all in-game objects. Both shared and non-shared objects are supported (by default, created objects are not shared). If an object is shared, only one instance of that object will be created; that instance will always be returned. Note that all objects loaded through this factory MUST ultimately be derived from org.bluesock.bluemud.lib.MudObject. The factory also supports the concept of aliased objects. These objects are given a special "alias" by which they can be referred, independent of their actual Python names. Aliased objects are normally used as bridges between standard and project-specific code (for example, when referring to the initial room that a player should be moved to upon login). Finally, the factory supports the notion of grouped object instances. Through the addGroupedInstance method, MudObject instances can be classified under named groups. Instances within the group can later be retrieved with the getGroupedInstances method. Instances can be removed from a named group with the removeGroupedInstance method.
Constructor Summary | |
ObjectFactory()
|
Method Summary | |
(package private) void |
addGroupedInstance(java.lang.String groupName,
MudObject instance)
Classify a named MudObject under the given group. |
(package private) MudObject |
getAliasedObject(java.lang.String alias,
boolean shared)
Get an instance of an aliased world class. |
(package private) MudObject[] |
getGroupedInstances(java.lang.String groupName)
Returns an array of MudObjects that were previously classified under the given group through a call to addGroupedInstance. |
(package private) MudObject |
getObject(OID objectIdentifier)
Get a reference to a world class by way of it's object identifier. |
(package private) MudObject |
getObject(java.lang.String dottedPath)
Get an instance of a world class. |
(package private) MudObject |
getObject(java.lang.String dottedPath,
boolean shared)
Get an instance of a world class. |
(package private) MudObject |
getObject(java.lang.String dottedPath,
boolean shared,
boolean reload)
Get an instance of a world class. |
(package private) boolean |
hasSharedInstance(java.lang.String dottedPath)
Determines if a loaded instance of the given path is currently being shared. |
(package private) void |
registerAlias(java.lang.String alias,
java.lang.String dottedPath)
Registers an alias with this factory, associating it with the given dottedPath. |
(package private) void |
removeGroupedInstance(java.lang.String groupName,
MudObject instance)
Removes the given MudObject from indicated group. |
(package private) void |
removeObject(MudObject o)
Removes the given object from the map of all loaded objects and from the map of shared objects, if necessary. |
Methods inherited from class java.lang.Object |
|
Constructor Detail |
public ObjectFactory()
Method Detail |
MudObject getObject(java.lang.String dottedPath)
dottedPath
- - The dotted path of the class. For
example: mudlib.core.ObjectMudObject getObject(java.lang.String dottedPath, boolean shared)
dottedPath
- - The dotted path of the class. For
example: mudlib.core.Roomshared
- - true if this object should be shared,
false otherwiseMudObject getObject(java.lang.String dottedPath, boolean shared, boolean reload)
dottedPath
- - The dotted path of the class. For
example: mudlib.core.Roomshared
- - true if this object should be shared,
false otherwisereload
- - true if the Python module housing the
given class should first be reloaded
prior to construction of an instance. If
the class is shared, a new instance will
be constructed that will replace the old
shared instance. False otherwise.MudObject getObject(OID objectIdentifier)
objectIdentifier
- - the OID of the world object in questionboolean hasSharedInstance(java.lang.String dottedPath)
dottedPath
- - The dotted path of the class. For example,
mudlib.core.RoomMudObject getAliasedObject(java.lang.String alias, boolean shared)
alias
- - The alias name of the object.shared
- - true if this object should be shared,
false otherwisevoid addGroupedInstance(java.lang.String groupName, MudObject instance)
groupName
- - Group name under which the MudObject should be
classified.instance
- - The instance of the MudObject to group.MudObject[] getGroupedInstances(java.lang.String groupName)
groupName
- - The name of the group under which the desired
MudObjects are classified. This must match a
group name previously passed to addGroupedInstance.void removeGroupedInstance(java.lang.String groupName, MudObject instance)
groupName
- - The name of the group from which the given
MudObject should be removed. This must match
a name previously passed to addGroupedInstance.instance
- - The MudObject to remove from the group.void registerAlias(java.lang.String alias, java.lang.String dottedPath)
alias
- - The alias to registerdottedPath
- - The dotted path to the object being
aliased. Example: world.sample.StartRoomvoid removeObject(MudObject o)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |