Package org.apache.wicket.injection
Class CompoundFieldValueFactory
- java.lang.Object
-
- org.apache.wicket.injection.CompoundFieldValueFactory
-
- All Implemented Interfaces:
IFieldValueFactory
public class CompoundFieldValueFactory extends Object implements IFieldValueFactory
Compound implementation of IFieldValueFactory. This field value factory will keep trying added factories until one returns a non-null value or all are tried.- Author:
- Igor Vaynberg (ivaynberg)
- See Also:
IFieldValueFactory
-
-
Constructor Summary
Constructors Constructor Description CompoundFieldValueFactory(List<IFieldValueFactory> factories)
ConstructorCompoundFieldValueFactory(IFieldValueFactory[] factories)
ConstructorCompoundFieldValueFactory(IFieldValueFactory f1, IFieldValueFactory f2)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFactory(IFieldValueFactory factory)
Adds a factory to the compound factoryObject
getFieldValue(Field field, Object fieldOwner)
Returns the value the field will be set toboolean
supportsField(Field field)
Returns true if the factory can generate a value for the field, false otherwise.
-
-
-
Constructor Detail
-
CompoundFieldValueFactory
public CompoundFieldValueFactory(IFieldValueFactory[] factories)
Constructor- Parameters:
factories
-
-
CompoundFieldValueFactory
public CompoundFieldValueFactory(List<IFieldValueFactory> factories)
Constructor- Parameters:
factories
-
-
CompoundFieldValueFactory
public CompoundFieldValueFactory(IFieldValueFactory f1, IFieldValueFactory f2)
Constructor- Parameters:
f1
-f2
-
-
-
Method Detail
-
addFactory
public void addFactory(IFieldValueFactory factory)
Adds a factory to the compound factory- Parameters:
factory
-
-
getFieldValue
public Object getFieldValue(Field field, Object fieldOwner)
Description copied from interface:IFieldValueFactory
Returns the value the field will be set to- Specified by:
getFieldValue
in interfaceIFieldValueFactory
- Parameters:
field
- field being injectedfieldOwner
- instance of object being injected- Returns:
- new field value
- See Also:
IFieldValueFactory.getFieldValue(java.lang.reflect.Field, java.lang.Object)
-
supportsField
public boolean supportsField(Field field)
Description copied from interface:IFieldValueFactory
Returns true if the factory can generate a value for the field, false otherwise. If this method returns false, getFieldValue() will not be called on this factory- Specified by:
supportsField
in interfaceIFieldValueFactory
- Parameters:
field
- field- Returns:
- true if the factory can generate a value for the field, false otherwise
- See Also:
IFieldValueFactory.supportsField(java.lang.reflect.Field)
-
-