org.springframework.beans.factory.config
Class ConstructorArgumentValues


public class ConstructorArgumentValues

Holder for constructor argument values for a bean. Supports values for a specific index in the constructor argument list and generic matches by type.

Author:
Juergen Hoeller
Since: 09.11.2003

Method Summary
 voidaddGenericArgumentValue(Object value)
          Add generic argument value to be matched by type.
 voidaddIndexedArgumentValue(int index, Object value)
          Add argument value for the given index in the constructor argument list.
 ObjectgetArgumentValue(int index, Class requiredType)
          Look for an argument value that either corresponds to the given index in the constructor argument list or generically matches by type.
 ObjectgetGenericArgumentValue(Class requiredType)
          Look for a generic argument value that matches the given type.
 SetgetGenericArgumentValues()
          Return the set of generic argument values.
 ObjectgetIndexedArgumentValue(int index)
          Get argument value for the given index in the constructor argument list.
 MapgetIndexedArgumentValues()
          Return the map of indexed argument values.
 intgetNrOfArguments()
          Return the number of arguments held in this instance.
 booleanisEmpty()
          Return if this holder does not contain any argument values, neither indexed ones nor generic ones.

Method Detail

addGenericArgumentValue

public void addGenericArgumentValue(Object value)
Add generic argument value to be matched by type.
Parameters:
value - the argument value

addIndexedArgumentValue

public void addIndexedArgumentValue(int index, Object value)
Add argument value for the given index in the constructor argument list.
Parameters:
index - the index in the constructor argument list
value - the argument value

getArgumentValue

public Object getArgumentValue(int index, Class requiredType)
Look for an argument value that either corresponds to the given index in the constructor argument list or generically matches by type.
Parameters:
index - the index in the constructor argument list
requiredType - the type to match
Returns: the argument value, or null if none found

getGenericArgumentValue

public Object getGenericArgumentValue(Class requiredType)
Look for a generic argument value that matches the given type.
Parameters:
requiredType - the type to match

getGenericArgumentValues

public Set getGenericArgumentValues()
Return the set of generic argument values.
Returns: Set with argument values

getIndexedArgumentValue

public Object getIndexedArgumentValue(int index)
Get argument value for the given index in the constructor argument list.
Parameters:
index - the index in the constructor argument list
Returns: the argument value, or null if none set

getIndexedArgumentValues

public Map getIndexedArgumentValues()
Return the map of indexed argument values.
Returns: Map with Integer indizes as keys and argument values as values

getNrOfArguments

public int getNrOfArguments()
Return the number of arguments held in this instance.

isEmpty

public boolean isEmpty()
Return if this holder does not contain any argument values, neither indexed ones nor generic ones.

Association Links

to Class java.util.Map

to Class java.util.Set