|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tapestry5.internal.model.MutableComponentModelImpl
public final class MutableComponentModelImpl
Internal implementation of MutableComponentModel
.
Constructor Summary | |
---|---|
MutableComponentModelImpl(String componentClassName,
org.slf4j.Logger logger,
Resource baseResource,
ComponentModel parentModel,
boolean pageClass)
|
Method Summary | |
---|---|
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 |
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. |
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 |
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()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MutableComponentModelImpl(String componentClassName, org.slf4j.Logger logger, Resource baseResource, ComponentModel parentModel, boolean pageClass)
Method Detail |
---|
public String toString()
toString
in class Object
public org.slf4j.Logger getLogger()
ComponentModel
getLogger
in interface ComponentModel
Log
public Resource getBaseResource()
ComponentModel
getBaseResource
in interface ComponentModel
public String getComponentClassName()
ComponentModel
getComponentClassName
in interface ComponentModel
public void addParameter(String name, boolean required, boolean allowNull, String defaultBindingPrefix, boolean cached)
MutableComponentModel
addParameter
in interface MutableComponentModel
name
- 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 renderingParameter
public void addParameter(String name, boolean required, boolean allowNull, String defaultBindingPrefix)
MutableComponentModel
addParameter
in interface MutableComponentModel
name
- 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 modelParameter
public ParameterModel getParameterModel(String parameterName)
ComponentModel
getParameterModel
in interface ComponentModel
parameterName
- the name of the parameter (case is ignored)
public boolean isFormalParameter(String parameterName)
ComponentModel
isFormalParameter
in interface ComponentModel
parameterName
- name of the parameter (case is ignored)public List<String> getParameterNames()
ComponentModel
getParameterNames
in interface ComponentModel
public List<String> getDeclaredParameterNames()
ComponentModel
getDeclaredParameterNames
in interface ComponentModel
public MutableEmbeddedComponentModel addEmbeddedComponent(String id, String type, String componentClassName, boolean inheritInformalParameters, Location location)
MutableComponentModel
addEmbeddedComponent
in interface MutableComponentModel
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
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()
ComponentModel
Component
annotation), including those defined by any super-class.
getEmbeddedComponentIds
in interface ComponentModel
public EmbeddedComponentModel getEmbeddedComponentModel(String componentId)
ComponentModel
getEmbeddedComponentModel
in interface ComponentModel
componentId
- the id of the embedded component
public String getFieldPersistenceStrategy(String fieldName)
ComponentModel
getFieldPersistenceStrategy
in interface ComponentModel
public List<String> getPersistentFieldNames()
ComponentModel
getPersistentFieldNames
in interface ComponentModel
Persist
public String setFieldPersistenceStrategy(String fieldName, String strategy)
MutableComponentModel
setFieldPersistenceStrategy
in interface MutableComponentModel
fieldName
- 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()
ComponentModel
isRootClass
in interface ComponentModel
public void addMixinClassName(String mixinClassName, String... order)
MutableComponentModel
addMixinClassName
in interface MutableComponentModel
public List<String> getMixinClassNames()
ComponentModel
getMixinClassNames
in interface ComponentModel
public void enableSupportsInformalParameters()
MutableComponentModel
enableSupportsInformalParameters
in interface MutableComponentModel
public boolean getSupportsInformalParameters()
ComponentModel
SupportsInformalParameters
annotation is present, or inherited from a super-class).
getSupportsInformalParameters
in interface ComponentModel
public ComponentModel getParentModel()
ComponentModel
getParentModel
in interface ComponentModel
public boolean isMixinAfter()
ComponentModel
MixinAfter
annotation.
isMixinAfter
in interface ComponentModel
public void setMixinAfter(boolean mixinAfter)
MutableComponentModel
setMixinAfter
in interface MutableComponentModel
public void setMeta(String key, String value)
MutableComponentModel
setMeta
in interface MutableComponentModel
public void addRenderPhase(Class renderPhase)
MutableComponentModel
addRenderPhase
in interface MutableComponentModel
renderPhase
- annotation class corresponding to the render phaseComponentModel.getHandledRenderPhases()
public void addEventHandler(String eventType)
MutableComponentModel
addEventHandler
in interface MutableComponentModel
eventType
- of handled eventpublic String getMeta(String key)
ComponentModel
getMeta
in interface ComponentModel
key
- identifies the value to be accessed
public Set<Class> getHandledRenderPhases()
ComponentModel
BeginRender
, AfterRender
, etc.).
getHandledRenderPhases
in interface ComponentModel
public boolean handlesEvent(String eventType)
ComponentModel
handlesEvent
in interface ComponentModel
eventType
- name of event to check (case insensitive)
public String[] getOrderForMixin(String mixinClassName)
getOrderForMixin
in interface ComponentModel
mixinClassName
- class name of the mixin for which the ordering is desired
public boolean isPage()
ComponentModel
isPage
in interface ComponentModel
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |