Class MutableComponentModelImpl

    • Constructor Summary

      Constructors 
      Constructor Description
       componentClassName, org.slf4j.Logger logger, Resource baseResource, ComponentModel parentModel, boolean pageClass,  libraryName)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      MutableEmbeddedComponentModel  id,  type,  componentClassName, boolean inheritInformalParameters, Location location)
      Defines a new embedded component.
      void  eventType)
      Identifies that the component includes an event handler for the indicated event type.
      void  mixinClassName, ... order)
      Adds a mixin to the component's implementation, optionally specifying ordering constraints, as per OrderedConfiguration.
      void  name, boolean required, boolean allowNull,  defaultBindingPrefix)
      Adds a new formal parameter to the model.
      void  name, boolean required, boolean allowNull,  defaultBindingPrefix, boolean cached)
      Adds a new formal parameter to the model.
      void  renderPhase)
      Identifies that the component does handle the render phase.
      void doHandleActivationEventContext()
      Relevant for pages only, identifies that the component handle EventConstants.ACTIVATE events supporting one of the three special case for catch all rules: [] EventContext
      void enableSupportsInformalParameters()
      Sets the internal flag to indicate that this model (and all models that extend from it) support informal parameters.
      Resource getBaseResource()
      Returns the resource corresponding to the class file for this component.
      getComponentClassName()
      The fully qualified class name of the component.
      <> 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).
      <> getEmbeddedComponentIds()
      Returns the ids of all embedded components defined within the component class (via the Component annotation), including those defined by any super-class.
      EmbeddedComponentModel  componentId)
      Returns an embedded component defined by this component or by a super-class.
       fieldName)
      Returns the persistent strategy associated with the field.
      <> getHandledRenderPhases()
      Returns a set of all the render phases that this model (including parent models) that are handled.
      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).
      org.slf4j.Logger getLogger()
      Returns object that will be used to log warnings and errors related to this component.
       key)
      Gets a meta value identified by the given key.
      <> getMixinClassNames()
      Returns a list of the class names of mixins that are part of the component's implementation.
      []  mixinClassName)  
      ParameterModel  parameterName)
      Return a single parameter model by parameter name, or null if the parameter is not defined (is not a formal parameter).
      <> getParameterNames()
      Returns an alphabetically sorted list of the names of all formal parameters.
      ComponentModel getParentModel()
      Returns the component model for this component's super-class, if it exists.
      <> getPersistentFieldNames()
      Returns a list of the names of all persistent fields (within this class, or any super-class).
      boolean getSupportsInformalParameters()
      Returns true if the model indicates that informal parameters, additional parameters beyond the formal parameter defined for the component, are supported.
      boolean handleActivationEventContext()
      Relevant for pages only, indicates that the component handle the EventConstants.ACTIVATE events with a catch all rules
      boolean  eventType)
      Determines if the component has an event handler for the indicated event name (case insensitive).
      boolean  parameterName)
      Returns true if the named parameter is formally defined (there's a ParameterModel).
      boolean isMixinAfter()
      Relevant for component mixins only.
      boolean isPage()
      Is this a model of a page (rather than a component, mixin, or base-class)?
      boolean isRootClass()
      Returns true if the modeled component is a root class, a component class whose parent class is not a component class.
       fieldName,  strategy)
      Used to define the field persistence strategy for a particular field name.
      void  key,  value)
      Stores a meta data value under the indicated key.
      void setMixinAfter​(boolean mixinAfter)
      Changes the value of the mixinAfter flag.
      toString()  
      • Methods inherited from class java.lang.

        , , , , , , , , ,
    • Constructor Detail

      • MutableComponentModelImpl

        public  componentClassName,
                                         org.slf4j.Logger logger,
                                         Resource baseResource,
                                         ComponentModel parentModel,
                                         boolean pageClass,
                                          libraryName)
    • Method Detail

      • getLibraryName

        public  getLibraryName()
        Description copied from interface: ComponentModel
        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.
        Specified by:
        getLibraryName in interface ComponentModel
        Returns:
        library name containing the component, or empty string for application components
      • toString

        public  toString()
        Overrides:
         in class 
      • getLogger

        public org.slf4j.Logger getLogger()
        Description copied from interface: ComponentModel
        Returns object that will be used to log warnings and errors related to this component.
        Specified by:
        getLogger in interface ComponentModel
        See Also:
        Log
      • getBaseResource

        public Resource getBaseResource()
        Description copied from interface: ComponentModel
        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.
        Specified by:
        getBaseResource in interface ComponentModel
      • addParameter

        public void  name,
                                 boolean required,
                                 boolean allowNull,
                                  defaultBindingPrefix,
                                 boolean cached)
        Description copied from interface: MutableComponentModel
        Adds a new formal parameter to the model. Each parameter has a unique name (though access to parameters is case insensitive).
        Specified by:
        addParameter in interface MutableComponentModel
        Parameters:
        name - new, unique name for the parameter
        required - if true, the parameter must be bound
        allowNull - if true, then parameter may be bound to null, if false a null check will be added
        defaultBindingPrefix - the default binding prefix for this parameter @throws IllegalArgumentException if a parameter with the given name has already been defined for this model
        cached - if true, the parameter value should be cached within the component during rendering
        See Also:
        Parameter
      • addParameter

        public void  name,
                                 boolean required,
                                 boolean allowNull,
                                  defaultBindingPrefix)
        Description copied from interface: MutableComponentModel
        Adds a new formal parameter to the model. Each parameter has a unique name (though access to parameters is case insensitive).
        Specified by:
        addParameter in interface MutableComponentModel
        Parameters:
        name - new, unique name for the parameter
        required - if true, the parameter must be bound
        allowNull - if true, then parameter may be bound to null, if false a null check will be added
        defaultBindingPrefix - the default binding prefix for this parameter @throws IllegalArgumentException if a parameter with the given name has already been defined for this model
        See Also:
        Parameter
      • getParameterModel

        public  parameterName)
        Description copied from interface: ComponentModel
        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.
        Specified by:
        getParameterModel in interface ComponentModel
        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

        public boolean  parameterName)
        Description copied from interface: ComponentModel
        Returns true if the named parameter is formally defined (there's a ParameterModel).
        Specified by:
        isFormalParameter in interface ComponentModel
        Parameters:
        parameterName - name of the parameter (case is ignored)
      • addEmbeddedComponent

        public  id,
                                                                   type,
                                                                   componentClassName,
                                                                  boolean inheritInformalParameters,
                                                                  Location location)
        Description copied from interface: MutableComponentModel
        Defines a new embedded component.
        Specified by:
        addEmbeddedComponent in interface MutableComponentModel
        Parameters:
        id - the unique id for the embedded component, which must not already exist.
        type - the type of the component (posslibly blank)
        componentClassName - the fully qualified class name (derived from the field), used if the type is blank
        inheritInformalParameters - if true, then the component will inherit informal parameters provided to its container
        location - where the component is defined @return a mutable model allowing parameters to be set
      • getEmbeddedComponentModel

        public  componentId)
        Description copied from interface: ComponentModel
        Returns an embedded component defined by this component or by a super-class.
        Specified by:
        getEmbeddedComponentModel in interface ComponentModel
        Parameters:
        componentId - the id of the embedded component
        Returns:
        the embedded component model, or null if no component exists with that id
      • getFieldPersistenceStrategy

        public   fieldName)
        Description copied from interface: ComponentModel
        Returns the persistent strategy associated with the field.
        Specified by:
        getFieldPersistenceStrategy in interface ComponentModel
        Returns:
        the corresponding strategy, or the empty string
      • isRootClass

        public boolean isRootClass()
        Description copied from interface: ComponentModel
        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.
        Specified by:
        isRootClass in interface ComponentModel
        Returns:
        true if a root class, false if a subclass
      • addMixinClassName

        public void  mixinClassName,
                                      ... order)
        Description copied from interface: MutableComponentModel
        Adds a mixin to the component's implementation, optionally specifying ordering constraints, as per OrderedConfiguration.
        Specified by:
        addMixinClassName in interface MutableComponentModel
      • getSupportsInformalParameters

        public boolean getSupportsInformalParameters()
        Description copied from interface: ComponentModel
        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).
        Specified by:
        getSupportsInformalParameters in interface ComponentModel
        Returns:
        true if this component model supports informal parameters
      • getParentModel

        public ComponentModel getParentModel()
        Description copied from interface: ComponentModel
        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.
        Specified by:
        getParentModel in interface ComponentModel
        Returns:
        the parent class model, or null if this component's super class is not itself a component class
      • isMixinAfter

        public boolean isMixinAfter()
        Description copied from interface: ComponentModel
        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.
        Specified by:
        isMixinAfter in interface ComponentModel
        Returns:
        true if the mixin should operate after, not before, the component
      • addEventHandler

        public void  eventType)
        Description copied from interface: MutableComponentModel
        Identifies that the component includes an event handler for the indicated event type.
        Specified by:
        addEventHandler in interface MutableComponentModel
        Parameters:
        eventType - of handled event
      • getMeta

        public   key)
        Description copied from interface: ComponentModel
        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.
        Specified by:
        getMeta in interface ComponentModel
        Parameters:
        key - identifies the value to be accessed
        Returns:
        the value for the key (possibly inherited from a parent model), or null
      • handlesEvent

        public boolean  eventType)
        Description copied from interface: ComponentModel
        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.
        Specified by:
        handlesEvent in interface ComponentModel
        Parameters:
        eventType - name of event to check (case insensitive)
        Returns:
        true if event handler present
      • getOrderForMixin

        public []  mixinClassName)
        Specified by:
        getOrderForMixin in interface ComponentModel
        Parameters:
        mixinClassName - class name of the mixin for which the ordering is desired
        Returns:
        the ordering constraint(s) for the mixin, potentially null.
      • isPage

        public boolean isPage()
        Description copied from interface: ComponentModel
        Is this a model of a page (rather than a component, mixin, or base-class)?
        Specified by:
        isPage in interface ComponentModel
        Returns:
        true if a page