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 IExternalAccessThe external access.protected static Function<Component,IExternalAccess> The external access supplier.The feature instances of this component, stored by the feature type.protected ComponentIdentifierThe 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> TgetFeature(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.voidhandleException(Exception exception) booleanhasFeature(Class<?> type) Check if has a feature.protected voidputFeature(Class<Object> type, Object feature) static voidSet the external access factory.voidTerminate the component.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
getIdin 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:
getFeaturein interfaceIComponent
-
terminate
public void terminate()Terminate the component.- Specified by:
terminatein interfaceIComponent
-
getPojo
Get the pojo.- Specified by:
getPojoin interfaceIComponent- Returns:
- The pojo.
-
putFeature
-
getExternalAccess
Get the external access.- Specified by:
getExternalAccessin interfaceIComponent- Returns:
- The external access.
-
handleException
-
getExternalAccess
Get the external access.- Specified by:
getExternalAccessin interfaceIComponent- Parameters:
cid- The component id.- Returns:
- The external access.
-
setExternalAccessFactory
Set the external access factory.- Parameters:
factory- The factory.
-
getClassLoader
-
createComponent
-