Class Component

java.lang.Object
jadex.core.impl.Component
All Implemented Interfaces:
IComponent

public class Component extends Object implements IComponent
Base class for Jadex components, which provides access to component features.
  • Field Details

  • Constructor Details

    • Component

      public Component()
      Create a new component and instantiate all features (except lazy features). Uses an auto-generated componment identifier.
    • Component

      public Component(ComponentIdentifier id)
      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

      public ComponentIdentifier getId()
      Get the id.
      Specified by:
      getId in interface IComponent
      Returns:
      The id.
    • getFeatures

      public Collection<Object> getFeatures()
      Get the internal set of currently instantiated features. Does not include lazy, which have not yet been accessed.
    • hasFeature

      public boolean hasFeature(Class<?> type)
      Check if has a feature.
      Returns:
      True, if it has the feature.
    • getFeature

      public <T> T getFeature(Class<T> type)
      Get the feature instance for the given type. Instantiates lazy features if needed.
      Specified by:
      getFeature in interface IComponent
    • terminate

      public void terminate()
      Terminate the component.
      Specified by:
      terminate in interface IComponent
    • getPojo

      public Object getPojo()
      Get the pojo.
      Specified by:
      getPojo in interface IComponent
      Returns:
      The pojo.
    • putFeature

      protected void putFeature(Class<Object> type, Object feature)
    • getExternalAccess

      public IExternalAccess getExternalAccess()
      Get the external access.
      Specified by:
      getExternalAccess in interface IComponent
      Returns:
      The external access.
    • handleException

      public void handleException(Exception exception)
    • getExternalAccess

      public IExternalAccess getExternalAccess(ComponentIdentifier cid)
      Get the external access.
      Specified by:
      getExternalAccess in interface IComponent
      Parameters:
      cid - The component id.
      Returns:
      The external access.
    • setExternalAccessFactory

      public static void setExternalAccessFactory(Function<Component,IExternalAccess> factory)
      Set the external access factory.
      Parameters:
      factory - The factory.
    • getClassLoader

      public ClassLoader getClassLoader()
    • createComponent

      public static <T extends Component> T createComponent(Class<T> type, Supplier<T> creator)