public final class MutableComponentModelImpl extends Object implements MutableComponentModel
MutableComponentModel.| Constructor and Description |
|---|
MutableComponentModelImpl(String componentClassName,
org.slf4j.Logger logger,
Resource baseResource,
ComponentModel parentModel,
boolean pageClass,
String libraryName) |
| Modifier and Type | Method and Description |
|---|---|
MutableEmbeddedComponentModel |
addEmbeddedComponent(String id,
String type,
String componentClassName,
boolean inheritInformalParameters,
Location location)
Defines a new embedded component.
|
void |
addEventHandler(String eventType)
Identifies that the component includes an event handler for the indicated event type.
|
void |
addMixinClassName(String mixinClassName,
String... order)
Adds a mixin to the component's implementation, optionally specifying ordering constraints, as per OrderedConfiguration.
|
void |
addParameter(String name,
boolean required,
boolean allowNull,
String defaultBindingPrefix)
Adds a new formal parameter to the model.
|
void |
addParameter(String name,
boolean required,
boolean allowNull,
String defaultBindingPrefix,
boolean cached)
Adds a new formal parameter to the model.
|
void |
addRenderPhase(Class 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:
|
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.
|
String |
getComponentClassName()
The fully qualified class name of the component.
|
List<String> |
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).
|
List<String> |
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 |
getEmbeddedComponentModel(String componentId)
Returns an embedded component defined by this component or by a super-class.
|
String |
getFieldPersistenceStrategy(String fieldName)
Returns the persistent strategy associated with the field.
|
Set<Class> |
getHandledRenderPhases()
Returns a set of all the render phases that this model (including parent models) that are handled.
|
String |
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.
|
String |
getMeta(String key)
Gets a meta value identified by the given key.
|
List<String> |
getMixinClassNames()
Returns a list of the class names of mixins that are part of the component's implementation.
|
String[] |
getOrderForMixin(String mixinClassName) |
ParameterModel |
getParameterModel(String parameterName)
Return a single parameter model by parameter name, or null if the parameter is not defined (is not
a formal parameter).
|
List<String> |
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.
|
List<String> |
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 |
handlesEvent(String eventType)
Determines if the component has an event handler for the indicated event name (case insensitive).
|
boolean |
isFormalParameter(String 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.
|
String |
setFieldPersistenceStrategy(String fieldName,
String strategy)
Used to define the field persistence strategy for a particular field name.
|
void |
setMeta(String key,
String value)
Stores a meta data value under the indicated key.
|
void |
setMixinAfter(boolean mixinAfter)
Changes the value of the mixinAfter flag.
|
String |
toString() |
public MutableComponentModelImpl(String componentClassName, org.slf4j.Logger logger, Resource baseResource, ComponentModel parentModel, boolean pageClass, String libraryName)
public String getLibraryName()
ComponentModelLibraryMapping contributions
to the ComponentClassResolver service.getLibraryName in interface ComponentModelpublic org.slf4j.Logger getLogger()
ComponentModelgetLogger in interface ComponentModelLogpublic Resource getBaseResource()
ComponentModelgetBaseResource in interface ComponentModelpublic String getComponentClassName()
ComponentModelgetComponentClassName in interface ComponentModelpublic void addParameter(String name, boolean required, boolean allowNull, String defaultBindingPrefix, boolean cached)
MutableComponentModeladdParameter in interface MutableComponentModelname - new, unique name for the parameterrequired - if true, the parameter must be boundallowNull - if true, then parameter may be bound to null, if false a null check will be addeddefaultBindingPrefix - the default binding prefix for this parameter @throws IllegalArgumentException if a
parameter with the given name has already been defined for this modelcached - if true, the parameter value should be cached within the component during renderingParameterpublic void addParameter(String name, boolean required, boolean allowNull, String defaultBindingPrefix)
MutableComponentModeladdParameter in interface MutableComponentModelname - new, unique name for the parameterrequired - if true, the parameter must be boundallowNull - if true, then parameter may be bound to null, if false a null check will be addeddefaultBindingPrefix - the default binding prefix for this parameter @throws IllegalArgumentException if a
parameter with the given name has already been defined for this modelParameterpublic ParameterModel getParameterModel(String parameterName)
ComponentModelgetParameterModel in interface ComponentModelparameterName - the name of the parameter (case is ignored)public boolean isFormalParameter(String parameterName)
ComponentModelisFormalParameter in interface ComponentModelparameterName - name of the parameter (case is ignored)public List<String> getParameterNames()
ComponentModelgetParameterNames in interface ComponentModelpublic List<String> getDeclaredParameterNames()
ComponentModelgetDeclaredParameterNames in interface ComponentModelpublic MutableEmbeddedComponentModel addEmbeddedComponent(String id, String type, String componentClassName, boolean inheritInformalParameters, Location location)
MutableComponentModeladdEmbeddedComponent in interface MutableComponentModelid - 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
blankinheritInformalParameters - if true, then the component will inherit informal parameters provided to its
containerlocation - where the component is defined @return a mutable model allowing parameters to be
setpublic List<String> getEmbeddedComponentIds()
ComponentModelComponent annotation), including those defined by any super-class.getEmbeddedComponentIds in interface ComponentModelpublic EmbeddedComponentModel getEmbeddedComponentModel(String componentId)
ComponentModelgetEmbeddedComponentModel in interface ComponentModelcomponentId - the id of the embedded componentpublic String getFieldPersistenceStrategy(String fieldName)
ComponentModelgetFieldPersistenceStrategy in interface ComponentModelpublic List<String> getPersistentFieldNames()
ComponentModelgetPersistentFieldNames in interface ComponentModelPersistpublic String setFieldPersistenceStrategy(String fieldName, String strategy)
MutableComponentModelsetFieldPersistenceStrategy in interface MutableComponentModelfieldName - the name of the field which is to be made persistentstrategy - the strategy for persisting the field, from Persist.value(). This value may be blank, in
which case the stategy is inherited from the component, or the component's container.ComponentModel.getFieldPersistenceStrategy(String),
and with InternalComponentResources.persistFieldChange(String, Object), etc.public boolean isRootClass()
ComponentModelisRootClass in interface ComponentModelpublic void addMixinClassName(String mixinClassName, String... order)
MutableComponentModeladdMixinClassName in interface MutableComponentModelpublic List<String> getMixinClassNames()
ComponentModelgetMixinClassNames in interface ComponentModelpublic void enableSupportsInformalParameters()
MutableComponentModelenableSupportsInformalParameters in interface MutableComponentModelpublic boolean getSupportsInformalParameters()
ComponentModelSupportsInformalParameters annotation is present, or inherited from a super-class).getSupportsInformalParameters in interface ComponentModelpublic ComponentModel getParentModel()
ComponentModelgetParentModel in interface ComponentModelpublic boolean isMixinAfter()
ComponentModelMixinAfter annotation.isMixinAfter in interface ComponentModelpublic void setMixinAfter(boolean mixinAfter)
MutableComponentModelsetMixinAfter in interface MutableComponentModelpublic void setMeta(String key, String value)
MutableComponentModelsetMeta in interface MutableComponentModelpublic void addRenderPhase(Class renderPhase)
MutableComponentModeladdRenderPhase in interface MutableComponentModelrenderPhase - annotation class corresponding to the render phaseComponentModel.getHandledRenderPhases()public void addEventHandler(String eventType)
MutableComponentModeladdEventHandler in interface MutableComponentModeleventType - of handled eventpublic String getMeta(String key)
ComponentModelgetMeta in interface ComponentModelkey - identifies the value to be accessedpublic Set<Class> getHandledRenderPhases()
ComponentModelBeginRender, AfterRender, etc.).getHandledRenderPhases in interface ComponentModelpublic boolean handlesEvent(String eventType)
ComponentModelhandlesEvent in interface ComponentModeleventType - name of event to check (case insensitive)public String[] getOrderForMixin(String mixinClassName)
getOrderForMixin in interface ComponentModelmixinClassName - class name of the mixin for which the ordering is desiredpublic boolean isPage()
ComponentModelisPage in interface ComponentModelpublic void doHandleActivationEventContext()
MutableComponentModelEventConstants.ACTIVATE
events supporting one of the three special case for catch all rules:
doHandleActivationEventContext in interface MutableComponentModelpublic boolean handleActivationEventContext()
ComponentModelEventConstants.ACTIVATE
events with a catch all ruleshandleActivationEventContext in interface ComponentModelMutableComponentModel.doHandleActivationEventContext()5.6.4 - Copyright © 2003-2021 The Apache Software Foundation.