org.apache.wicket.injection
Class CompoundFieldValueFactory

java.lang.Object
  extended by 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
CompoundFieldValueFactory(IFieldValueFactory[] factories)
          Constructor
CompoundFieldValueFactory(IFieldValueFactory f1, IFieldValueFactory f2)
          Constructor
CompoundFieldValueFactory(java.util.List factories)
          Constructor
 
Method Summary
 void addFactory(IFieldValueFactory factory)
          Adds a factory to the compound factory
 java.lang.Object getFieldValue(java.lang.reflect.Field field, java.lang.Object fieldOwner)
          Returns the value the field will be set to
 boolean supportsField(java.lang.reflect.Field field)
          Returns true if the factory can generate a value for the field, false otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompoundFieldValueFactory

public CompoundFieldValueFactory(IFieldValueFactory[] factories)
Constructor

Parameters:
factories -

CompoundFieldValueFactory

public CompoundFieldValueFactory(java.util.List 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: IFieldValueFactory
Returns the value the field will be set to

Specified by:
getFieldValue in interface IFieldValueFactory
Parameters:
field - field being injected
fieldOwner - 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: 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 interface IFieldValueFactory
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)


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.