public class ComponentFactory extends Object
| Constructor and Description |
|---|
ComponentFactory(ComponentDefinition def) |
| Modifier and Type | Method and Description |
|---|---|
List<BaseComponent> |
create(Map<String,String> attributes,
ELContext elContext)
Creates one or more component instances from the component definition using a factory
context.
|
protected void |
setCase(Object caseVal)
Specifies the value for matching a switch statement.
|
protected void |
setForEach(Object forEach)
Sets an iterable which will be used to produce one component for each value returned by the
iterable.
|
protected void |
setForVar(String forVar)
Sets the attribute name to use in foreach iteration.
|
protected void |
setIf(boolean condition)
Conditionally prevents the factory from creating a component.
|
protected void |
setImplementationClass(Class<? extends BaseComponent> clazz)
A special processor may modify the component's implementation class, as long as the
substituted class is a subclass of the original.
|
protected void |
setSwitch(Object switchVal)
Specifies the value for a switch statement.
|
protected void |
setUnless(boolean condition)
Conditionally prevents the factory from creating a component.
|
public ComponentFactory(ComponentDefinition def)
@Component.FactoryParameter(value="impl", description="Component implementation class to substitute.") protected void setImplementationClass(Class<? extends BaseComponent> clazz)
clazz - Component implementation class to substitute.@Component.FactoryParameter(value="if", description="If false, prevent component creation.") protected void setIf(boolean condition)
condition - If false, prevent factory from creating a component.@Component.FactoryParameter(value="unless", description="If true, prevent component creation.") protected void setUnless(boolean condition)
condition - If true, prevent factory from creating a component.@Component.FactoryParameter(value="foreach", description="Specifies a collection for iterative component creation.") protected void setForEach(Object forEach)
forEach - An object that will be converted to an iterable. See
convertToITerable for
supported types.@Component.FactoryParameter(value="forvar", defaultValue="each", description="Specifies the attribute name used in foreach.") protected void setForVar(String forVar)
forVar - Name of attribute to use in foreach iteration.@Component.FactoryParameter(value="switch", description="Specifies the value for a switch statement.") protected void setSwitch(Object switchVal)
switchVal - Value for a switch statement.@Component.FactoryParameter(value="case", description="Specifies the value for matching a switch statement.") protected void setCase(Object caseVal)
caseVal - Value for matching a switch statement.public List<BaseComponent> create(Map<String,String> attributes, ELContext elContext)
attributes - Attribute map for initializing.elContext - Evaluation context for EL expressions.Copyright © 2018 Fujion Framework. All rights reserved.