org.springframework.beans.factory.config
Class ConstructorArgumentValues

java.lang.Object
  extended byorg.springframework.beans.factory.config.ConstructorArgumentValues

public class ConstructorArgumentValues
extends java.lang.Object

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

Since:
09.11.2003
Author:
Juergen Hoeller

Nested Class Summary
static class ConstructorArgumentValues.ValueHolder
          Holder for a constructor argument value, with an optional type attribute indicating the target type of the actual constructor argument.
 
Constructor Summary
ConstructorArgumentValues()
          Create new ConstructorArgumentValues.
ConstructorArgumentValues(ConstructorArgumentValues other)
          Deep copy constructor.
 
Method Summary
 void addArgumentValues(ConstructorArgumentValues other)
          Copy all given argument values into this object.
 void addGenericArgumentValue(java.lang.Object value)
          Add generic argument value to be matched by type.
 void addGenericArgumentValue(java.lang.Object value, java.lang.String type)
          Add generic argument value to be matched by type.
 void addIndexedArgumentValue(int index, java.lang.Object value)
          Add argument value for the given index in the constructor argument list.
 void addIndexedArgumentValue(int index, java.lang.Object value, java.lang.String type)
          Add argument value for the given index in the constructor argument list.
 int getArgumentCount()
          Return the number of arguments held in this instance.
 ConstructorArgumentValues.ValueHolder getArgumentValue(int index, java.lang.Class requiredType)
          Look for an argument value that either corresponds to the given index in the constructor argument list or generically matches by type.
 ConstructorArgumentValues.ValueHolder getGenericArgumentValue(java.lang.Class requiredType)
          Look for a generic argument value that matches the given type.
 java.util.Set getGenericArgumentValues()
          Return the set of generic argument values.
 ConstructorArgumentValues.ValueHolder getIndexedArgumentValue(int index, java.lang.Class requiredType)
          Get argument value for the given index in the constructor argument list.
 java.util.Map getIndexedArgumentValues()
          Return the map of indexed argument values.
 int getNrOfArguments()
          Deprecated. in favor of getArgumentCount
 boolean isEmpty()
          Return if this holder does not contain any argument values, neither indexed ones nor generic ones.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstructorArgumentValues

public ConstructorArgumentValues()
Create new ConstructorArgumentValues.


ConstructorArgumentValues

public ConstructorArgumentValues(ConstructorArgumentValues other)
Deep copy constructor.

Method Detail

addArgumentValues

public void addArgumentValues(ConstructorArgumentValues other)
Copy all given argument values into this object.


addIndexedArgumentValue

public void addIndexedArgumentValue(int index,
                                    java.lang.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

addIndexedArgumentValue

public void addIndexedArgumentValue(int index,
                                    java.lang.Object value,
                                    java.lang.String type)
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

getIndexedArgumentValue

public ConstructorArgumentValues.ValueHolder getIndexedArgumentValue(int index,
                                                                     java.lang.Class requiredType)
Get argument value for the given index in the constructor argument list.

Parameters:
index - the index in the constructor argument list
Returns:
the ValueHolder for the argument, or null if none set

getIndexedArgumentValues

public java.util.Map getIndexedArgumentValues()
Return the map of indexed argument values.

Returns:
Map with Integer indizes as keys and ValueHolders as values
See Also:
ConstructorArgumentValues.ValueHolder

addGenericArgumentValue

public void addGenericArgumentValue(java.lang.Object value)
Add generic argument value to be matched by type.

Note: A single generic argument value will just be used once, rather than matched multiple times (as of Spring 1.1).

Parameters:
value - the argument value

addGenericArgumentValue

public void addGenericArgumentValue(java.lang.Object value,
                                    java.lang.String type)
Add generic argument value to be matched by type.

Note: A single generic argument value will just be used once, rather than matched multiple times (as of Spring 1.1).

Parameters:
value - the argument value

getGenericArgumentValue

public ConstructorArgumentValues.ValueHolder getGenericArgumentValue(java.lang.Class requiredType)
Look for a generic argument value that matches the given type.

Parameters:
requiredType - the type to match
Returns:
the ValueHolder for the argument, or null if none set

getGenericArgumentValues

public java.util.Set getGenericArgumentValues()
Return the set of generic argument values.

Returns:
Set of ValueHolders
See Also:
ConstructorArgumentValues.ValueHolder

getArgumentValue

public ConstructorArgumentValues.ValueHolder getArgumentValue(int index,
                                                              java.lang.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 ValueHolder for the argument, or null if none set

getArgumentCount

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


getNrOfArguments

public int getNrOfArguments()
Deprecated. in favor of getArgumentCount

Return the number of arguments held in this instance.

See Also:
getArgumentCount()

isEmpty

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



Copyright (C) 2003-2004 The Spring Framework Project.