Package org.apache.wicket.injection
Class CompoundFieldValueFactory
- java.lang.Object
-
- org.apache.wicket.injection.CompoundFieldValueFactory
-
- All Implemented Interfaces:
IFieldValueFactory
public class CompoundFieldValueFactory extends java.lang.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(java.util.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 voidaddFactory(IFieldValueFactory factory)Adds a factory to the compound factoryjava.lang.ObjectgetFieldValue(java.lang.reflect.Field field, java.lang.Object fieldOwner)Returns the value the field will be set tobooleansupportsField(java.lang.reflect.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(java.util.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 java.lang.Object getFieldValue(java.lang.reflect.Field field, java.lang.Object fieldOwner)Description copied from interface:IFieldValueFactoryReturns the value the field will be set to- Specified by:
getFieldValuein 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(java.lang.reflect.Field field)
Description copied from interface:IFieldValueFactoryReturns 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:
supportsFieldin 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)
-
-