Package jadex.core.impl
Class Component
java.lang.Object
jadex.core.impl.Component
- All Implemented Interfaces:
IComponent
Base class for Jadex components, which provides access to component features.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IExternalAccess
The external access.protected static Function
<Component, IExternalAccess> The external access supplier.The feature instances of this component, stored by the feature type.protected ComponentIdentifier
The id.protected Map
<Class<Object>, FeatureProvider<Object>> The providers for this component type, stored by the feature type they provide.Fields inherited from interface jadex.core.IComponent
COMPONENT_ADDED, COMPONENT_LASTREMOVED, COMPONENT_REMOVED
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new component and instantiate all features (except lazy features).Create a new component and instantiate all features (except lazy features). -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Component>
TcreateComponent
(Class<T> type, Supplier<T> creator) Get the external access.Get the external access.<T> T
getFeature
(Class<T> type) Get the feature instance for the given type.Get the internal set of currently instantiated features.getId()
Get the id.getPojo()
Get the pojo.void
handleException
(Exception exception) boolean
hasFeature
(Class<?> type) Check if has a feature.protected void
putFeature
(Class<Object> type, Object feature) static void
Set the external access factory.void
Terminate the component.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface jadex.core.IComponent
waitForTermination
-
Field Details
-
providers
The providers for this component type, stored by the feature type they provide. Is also used at runtime to instantiate lazy features. -
features
The feature instances of this component, stored by the feature type. -
id
The id. -
access
The external access. -
accessfactory
The external access supplier.
-
-
Constructor Details
-
Component
public Component()Create a new component and instantiate all features (except lazy features). Uses an auto-generated componment identifier. -
Component
Create a new component and instantiate all features (except lazy features).- Parameters:
id
- The id to use or null for an auto-generated id.- Throws:
IllegalArgumentException
- when the id already exists.
-
-
Method Details
-
getId
Get the id.- Specified by:
getId
in interfaceIComponent
- Returns:
- The id.
-
getFeatures
Get the internal set of currently instantiated features. Does not include lazy, which have not yet been accessed. -
hasFeature
Check if has a feature.- Returns:
- True, if it has the feature.
-
getFeature
Get the feature instance for the given type. Instantiates lazy features if needed.- Specified by:
getFeature
in interfaceIComponent
-
terminate
public void terminate()Terminate the component.- Specified by:
terminate
in interfaceIComponent
-
getPojo
Get the pojo.- Specified by:
getPojo
in interfaceIComponent
- Returns:
- The pojo.
-
putFeature
-
getExternalAccess
Get the external access.- Specified by:
getExternalAccess
in interfaceIComponent
- Returns:
- The external access.
-
handleException
-
getExternalAccess
Get the external access.- Specified by:
getExternalAccess
in interfaceIComponent
- Parameters:
cid
- The component id.- Returns:
- The external access.
-
setExternalAccessFactory
Set the external access factory.- Parameters:
factory
- The factory.
-
getClassLoader
-
createComponent
-