Interface ComponentModel

All Known Subinterfaces:
MutableComponentModel
All Known Implementing Classes:
MutableComponentModelImpl

public interface ComponentModel
Defines a component in terms of its capabilities, parameters, sub-components, etc. During runtime, the component model is immutable. During construction time, when the class is being transformed and loaded, the model is mutable.
See Also:
  • Method Details

    • getLibraryName

      Returns the name of the library that defines this component; this may be the empty string for an application page or component, or will be a name of a library (possibly including "core" for built-in components). Library names are defined by the LibraryMapping contributions to the ComponentClassResolver service.
      Returns:
      library name containing the component, or empty string for application components
      Since:
      5.4
    • isPage

      boolean isPage()
      Is this a model of a page (rather than a component, mixin, or base-class)?
      Returns:
      true if a page
      Since:
      5.3
    • getBaseResource

      Returns the resource corresponding to the class file for this component. This is used to find related resources, such as the component's template and message catalog.
    • getComponentClassName

      The fully qualified class name of the component.
    • getEmbeddedComponentIds

      Returns the ids of all embedded components defined within the component class (via the Component annotation), including those defined by any super-class.
    • getEmbeddedComponentModel

      Returns an embedded component defined by this component or by a super-class.
      Parameters:
      componentId - the id of the embedded component
      Returns:
      the embedded component model, or null if no component exists with that id
    • getFieldPersistenceStrategy

      Returns the persistent strategy associated with the field.
      Parameters:
      fieldName -
      Returns:
      the corresponding strategy, or the empty string
      Throws:
      IllegalArgumentException - if the named field is not marked as persistent
    • getLogger

      org.slf4j.Logger getLogger()
      Returns object that will be used to log warnings and errors related to this component.
      See Also:
    • getMixinClassNames

      Returns a list of the class names of mixins that are part of the component's implementation.
    • getParameterModel

      Return a single parameter model by parameter name, or null if the parameter is not defined (is not a formal parameter). This may be a parameter defined by this component, or from a base class.
      Parameters:
      parameterName - the name of the parameter (case is ignored)
      Returns:
      the parameter model if found in this model or a parent model, or null if not found
    • isFormalParameter

      boolean isFormalParameter(String parameterName)
      Returns true if the named parameter is formally defined (there's a ParameterModel).
      Parameters:
      parameterName - name of the parameter (case is ignored)
      Since:
      5.2.0
    • getParameterNames

      Returns an alphabetically sorted list of the names of all formal parameters. This includes parameters defined by a base class.
    • getDeclaredParameterNames

      Returns an alphabetically sorted list of the names of all formal parameters defined by this specific class (parameters inherited from base classes are not identified).
    • getPersistentFieldNames

      Returns a list of the names of all persistent fields (within this class, or any super-class). The names are sorted alphabetically.
      See Also:
    • isRootClass

      boolean isRootClass()
      Returns true if the modeled component is a root class, a component class whose parent class is not a component class. We may in the future require that components only extend from Object.
      Returns:
      true if a root class, false if a subclass
    • getSupportsInformalParameters

      Returns true if the model indicates that informal parameters, additional parameters beyond the formal parameter defined for the component, are supported. This is false in most cases, but may be set to true for specific classes (when the SupportsInformalParameters annotation is present, or inherited from a super-class).
      Returns:
      true if this component model supports informal parameters
    • getParentModel

      Returns the component model for this component's super-class, if it exists. Remember that only classes in the correct packages, are considered component classes.
      Returns:
      the parent class model, or null if this component's super class is not itself a component class
    • isMixinAfter

      boolean isMixinAfter()
      Relevant for component mixins only. Indicates that the mixin behavior should occur after (not before) the component. Normally, this flag is set by the presence of the MixinAfter annotation.
      Returns:
      true if the mixin should operate after, not before, the component
    • getMeta

      Gets a meta value identified by the given key. If the current model does not provide a value for the key, then the parent component model (if any) is searched.
      Parameters:
      key - identifies the value to be accessed
      Returns:
      the value for the key (possibly inherited from a parent model), or null
    • getHandledRenderPhases

      Returns a set of all the render phases that this model (including parent models) that are handled. Render phases are represented by the corresponding annotation (BeginRender, AfterRender, etc.).
      Returns:
      set of classes
      Since:
      5.0.19, 5.1.0.0
    • handlesEvent

      boolean handlesEvent(String eventType)
      Determines if the component has an event handler for the indicated event name (case insensitive). This includes handlers in the component class itself, or its super-classes, but does not include event handlers supplied by implementation or instance mixins.
      Parameters:
      eventType - name of event to check (case insensitive)
      Returns:
      true if event handler present
    • getOrderForMixin

      String[] getOrderForMixin(String mixinClassName)
      Parameters:
      mixinClassName - class name of the mixin for which the ordering is desired
      Returns:
      the ordering constraint(s) for the mixin, potentially null.
      Since:
      5.2.0
    • handleActivationEventContext

      Relevant for pages only, indicates that the component handle the EventConstants.ACTIVATE events with a catch all rules
      Returns:
      true if the page implements catch all rules for the activate event context, or false otherwise
      Since:
      5.4
      See Also: