Class ComponentDescriptor

java.lang.Object
ortus.boxlang.runtime.components.ComponentDescriptor

public class ComponentDescriptor extends Object
This class is used to describe a component as it can be a component or a member component or both or coming from a module It also lazily creates the component instance and caches it upon first use
  • Field Details

    • name

      public Key name
      component name
    • allowsBody

      public Boolean allowsBody
      component allows a body. Used to help validate parsing
    • requiresBody

      public Boolean requiresBody
      component requires a body. Used to help validate parsing
    • componentClass

      public Class<?> componentClass
      component class
    • module

      public String module
      Module name, or null if core
    • componentInstance

      public volatile Component componentInstance
      component instance, lazily created
    • interceptorService

      protected InterceptorService interceptorService
      The interceptor service helper
  • Constructor Details

    • ComponentDescriptor

      public ComponentDescriptor(Key name, Class<?> componentClass, String module, String namespace, Component componentInstance, Boolean allowsBody, Boolean requiresBody)
      Constructor for a component
      Parameters:
      name - The name of the component
      componentClass - The class of the component
      module - The module name, or null if core
      componentInstance - The component instance or null by default
  • Method Details

    • hasModule

      public Boolean hasModule()
      Descriptor belongs to a modules or not
      Returns:
      True if the descriptor belongs to a module, false otherwise
    • allowsBody

      public Boolean allowsBody()
      Descriptor allows a body or not
    • requiresBody

      public Boolean requiresBody()
      Descriptor requires a body or not
    • getComponent

      public Component getComponent()
      Get the component instance for this descriptor and lazily create it if needed
      Returns:
      The component instance
    • invoke

      public Component.BodyResult invoke(IBoxContext context, Component.ComponentBody componentBody)
      Invoke the component with no arguments
      Parameters:
      context - The context
      Returns:
      The result of the invocation
    • invoke

      public Component.BodyResult invoke(IBoxContext context, IStruct attributes, Component.ComponentBody componentBody)
      Invoke the component with attributes
      Parameters:
      context - The context
      attributes - The attributes
      Returns:
      The result of the invocation
    • invokeModule

      public Component.BodyResult invokeModule(IBoxContext context, IStruct attributes, Component.ComponentBody componentBody)
      Invoke the component with attributes
      Parameters:
      context - The context
      attributes - The attributes
      Returns:
      The result of the invocation