|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.riotfamily.common.beans.xml.AbstractGenericBeanDefinitionParser
org.riotfamily.common.beans.xml.GenericBeanDefinitionParser
public class GenericBeanDefinitionParser
Field Summary | |
---|---|
String |
aliasAttribute
|
static String |
DEFAULT_ALIAS_ATTRIBUTE
|
Fields inherited from class org.riotfamily.common.beans.xml.AbstractGenericBeanDefinitionParser |
---|
ID_ATTRIBUTE |
Constructor Summary | |
---|---|
GenericBeanDefinitionParser(Class<?> beanClass)
|
|
GenericBeanDefinitionParser(String className)
|
Method Summary | |
---|---|
GenericBeanDefinitionParser |
addReference(String attributeName)
|
GenericBeanDefinitionParser |
addTranslation(String attributeName,
String property)
|
protected void |
doParse(Element element,
ParserContext parserContext,
BeanDefinitionBuilder builder)
Parse the supplied Element and populate the supplied
BeanDefinitionBuilder as required. |
protected String |
extractPropertyName(String attributeName)
Extract a JavaBean property name from the supplied attribute name. |
protected boolean |
isEligibleAttribute(String attributeName)
Determine whether the given attribute is eligible for being turned into a corresponding bean property value. |
protected void |
postProcess(BeanDefinitionBuilder beanDefinition,
Element element)
Hook method that derived classes can implement to inspect/change a bean definition after parsing is complete. |
protected void |
postProcess(BeanDefinitionBuilder beanDefinition,
ParserContext parserContext,
Element element)
Hook method that derived classes can implement to inspect/change a bean definition after parsing is complete. |
protected String |
resolveAlias(Element element,
AbstractBeanDefinition definition,
ParserContext parserContext)
Resolve the alias for the supplied BeanDefinition . |
void |
setAliasAttribute(String aliasAttribute)
|
Methods inherited from class org.riotfamily.common.beans.xml.AbstractGenericBeanDefinitionParser |
---|
doParse, parse, parseInternal, postProcessComponentDefinition, registerBeanDefinition, resolveAliases, resolveId, setDecorate, shouldFireEvents, shouldGenerateId, shouldGenerateIdAsFallback |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_ALIAS_ATTRIBUTE
public String aliasAttribute
Constructor Detail |
---|
public GenericBeanDefinitionParser(Class<?> beanClass)
public GenericBeanDefinitionParser(String className)
Method Detail |
---|
public GenericBeanDefinitionParser addTranslation(String attributeName, String property)
public GenericBeanDefinitionParser addReference(String attributeName)
public void setAliasAttribute(String aliasAttribute)
protected String resolveAlias(Element element, AbstractBeanDefinition definition, ParserContext parserContext)
AbstractGenericBeanDefinitionParser
BeanDefinition
. The returned
String may contain multiple bean-names separated by commas, semicolons
or spaces. The default implementation returns null
resolveAlias
in class AbstractGenericBeanDefinitionParser
protected final void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder)
Element
and populate the supplied
BeanDefinitionBuilder
as required.
This implementation maps any attributes present on the
supplied element to PropertyValue
instances, and
adds them
to the
builder
.
The extractPropertyName(String)
method is used to
reconcile the name of an attribute with the name of a JavaBean
property.
doParse
in class AbstractGenericBeanDefinitionParser
element
- the XML element being parsedparserContext
- the object encapsulating the current state of the parsing processbuilder
- used to define the BeanDefinition
extractPropertyName(String)
protected boolean isEligibleAttribute(String attributeName)
The default implementation considers any attribute as eligible, except for the "id" and "name" attributes.
attributeName
- the attribute name taken straight from the
XML element being parsed (never null
)protected String extractPropertyName(String attributeName)
The default implementation first looks for a translation set via
addTranslation(String, String)
. If no translation is found,
the Conventions.attributeNameToPropertyName(String)
method to perform the extraction.
The name returned must obey the standard JavaBean property name
conventions. For example for a class with a setter method
'setBingoHallFavourite(String)
', the name returned had
better be 'bingoHallFavourite
' (with that exact casing).
attributeName
- the attribute name taken straight from the
XML element being parsed (never null
)
null
)protected void postProcess(BeanDefinitionBuilder beanDefinition, ParserContext parserContext, Element element)
The default implementation delegates to the postProcess
version without ParserContext argument.
beanDefinition
- the parsed (and probably totally defined) bean definition being builtparserContext
- the object encapsulating the current state of the parsing processelement
- the XML element that was the source of the bean definition's metadataprotected void postProcess(BeanDefinitionBuilder beanDefinition, Element element)
The default implementation does nothing.
beanDefinition
- the parsed (and probably totally defined) bean definition being builtelement
- the XML element that was the source of the bean definition's metadata
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |