Package com.rpl.agentorama
Interface AgentObjectSetup
- All Superinterfaces:
AgentObjectFetcher
Setup context for agent object builders.
AgentObjectSetup provides access to other agent objects and the current object's
name during the object building process. This is passed to agent object builder
functions to enable objects to depend on other objects or access their own name.
This interface is used when declaring agent object builders with:
AgentTopology.declareAgentObjectBuilder(String, com.rpl.rama.ops.RamaFunction1)
Example:
topology.declareAgentObjectBuilder("myService", (AgentObjectSetup setup) -> {
// Get the name of the object being built
String objectName = setup.getObjectName();
// Access other agent objects if needed
DatabaseConnection db = setup.getAgentObject("database");
Logger logger = setup.getAgentObject("logger");
// Build the service with dependencies
return new MyService(objectName, db, logger);
});
-
Method Summary
Modifier and TypeMethodDescriptionGets the name of the agent object being built.Methods inherited from interface com.rpl.agentorama.AgentObjectFetcher
getAgentObject
-
Method Details
-
getObjectName
String getObjectName()Gets the name of the agent object being built. This is the name that was specified when declaring the agent object builder in the topology.- Returns:
- the name of the agent object being built
-