Package ortus.boxlang.runtime.components
Class ComponentDescriptor
java.lang.Object
ortus.boxlang.runtime.components.ComponentDescriptor
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 Summary
FieldsModifier and TypeFieldDescriptioncomponent allows a body.Class
<?> component classcomponent instance, lazily createdprotected InterceptorService
The interceptor service helperModule name, or null if corecomponent namecomponent requires a body. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDescriptor allows a body or notGet the component instance for this descriptor and lazily create it if neededDescriptor belongs to a modules or notinvoke
(IBoxContext context, Component.ComponentBody componentBody) Invoke the component with no argumentsinvoke
(IBoxContext context, IStruct attributes, Component.ComponentBody componentBody) Invoke the component with attributesinvokeModule
(IBoxContext context, IStruct attributes, Component.ComponentBody componentBody) Invoke the component with attributesDescriptor requires a body or not
-
Field Details
-
name
component name -
allowsBody
component allows a body. Used to help validate parsing -
requiresBody
component requires a body. Used to help validate parsing -
componentClass
component class -
module
Module name, or null if core -
componentInstance
component instance, lazily created -
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 componentcomponentClass
- The class of the componentmodule
- The module name, or null if corecomponentInstance
- The component instance or null by default
-
-
Method Details
-
hasModule
Descriptor belongs to a modules or not- Returns:
- True if the descriptor belongs to a module, false otherwise
-
allowsBody
Descriptor allows a body or not -
requiresBody
Descriptor requires a body or not -
getComponent
Get the component instance for this descriptor and lazily create it if needed- Returns:
- The component instance
-
invoke
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 contextattributes
- 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 contextattributes
- The attributes- Returns:
- The result of the invocation
-