|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.beans.factory.config.ConstructorArgumentValues
public class ConstructorArgumentValues
Holder for constructor argument values, typically as part of a bean definition.
Supports values for a specific index in the constructor argument list as well as for generic argument matches by type.
BeanDefinition.getConstructorArgumentValues()
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 a new empty ConstructorArgumentValues object. |
|
ConstructorArgumentValues(ConstructorArgumentValues original)
Deep copy constructor. |
Method Summary | |
---|---|
void |
addArgumentValues(ConstructorArgumentValues other)
Copy all given argument values into this object, using separate holder instances to keep the values independent from the original object. |
void |
addGenericArgumentValue(ConstructorArgumentValues.ValueHolder newValue)
Add a generic argument value to be matched by type or name (if available). |
void |
addGenericArgumentValue(Object value)
Add a generic argument value to be matched by type. |
void |
addGenericArgumentValue(Object value,
String type)
Add a generic argument value to be matched by type. |
void |
addIndexedArgumentValue(int index,
ConstructorArgumentValues.ValueHolder newValue)
Add an argument value for the given index in the constructor argument list. |
void |
addIndexedArgumentValue(int index,
Object value)
Add an argument value for the given index in the constructor argument list. |
void |
addIndexedArgumentValue(int index,
Object value,
String type)
Add an argument value for the given index in the constructor argument list. |
void |
clear()
Clear this holder, removing all argument values. |
boolean |
equals(Object other)
|
int |
getArgumentCount()
Return the number of argument values held in this instance, counting both indexed and generic argument values. |
ConstructorArgumentValues.ValueHolder |
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. |
ConstructorArgumentValues.ValueHolder |
getArgumentValue(int index,
Class requiredType,
String requiredName)
Look for an argument value that either corresponds to the given index in the constructor argument list or generically matches by type. |
ConstructorArgumentValues.ValueHolder |
getArgumentValue(int index,
Class requiredType,
String requiredName,
Set<ConstructorArgumentValues.ValueHolder> usedValueHolders)
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(Class requiredType)
Look for a generic argument value that matches the given type. |
ConstructorArgumentValues.ValueHolder |
getGenericArgumentValue(Class requiredType,
String requiredName)
Look for a generic argument value that matches the given type. |
ConstructorArgumentValues.ValueHolder |
getGenericArgumentValue(Class requiredType,
String requiredName,
Set<ConstructorArgumentValues.ValueHolder> usedValueHolders)
Look for the next generic argument value that matches the given type, ignoring argument values that have already been used in the current resolution process. |
List<ConstructorArgumentValues.ValueHolder> |
getGenericArgumentValues()
Return the list of generic argument values. |
ConstructorArgumentValues.ValueHolder |
getIndexedArgumentValue(int index,
Class requiredType)
Get argument value for the given index in the constructor argument list. |
ConstructorArgumentValues.ValueHolder |
getIndexedArgumentValue(int index,
Class requiredType,
String requiredName)
Get argument value for the given index in the constructor argument list. |
Map<Integer,ConstructorArgumentValues.ValueHolder> |
getIndexedArgumentValues()
Return the map of indexed argument values. |
int |
hashCode()
|
boolean |
hasIndexedArgumentValue(int index)
Check whether an argument value has been registered for the given index. |
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, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConstructorArgumentValues()
public ConstructorArgumentValues(ConstructorArgumentValues original)
original
- the ConstructorArgumentValues to copyMethod Detail |
---|
public void addArgumentValues(ConstructorArgumentValues other)
Note: Identical ValueHolder instances will only be registered once, to allow for merging and re-merging of argument value definitions. Distinct ValueHolder instances carrying the same content are of course allowed.
public void addIndexedArgumentValue(int index, Object value)
index
- the index in the constructor argument listvalue
- the argument valuepublic void addIndexedArgumentValue(int index, Object value, String type)
index
- the index in the constructor argument listvalue
- the argument valuetype
- the type of the constructor argumentpublic void addIndexedArgumentValue(int index, ConstructorArgumentValues.ValueHolder newValue)
index
- the index in the constructor argument listnewValue
- the argument value in the form of a ValueHolderpublic boolean hasIndexedArgumentValue(int index)
index
- the index in the constructor argument listpublic ConstructorArgumentValues.ValueHolder getIndexedArgumentValue(int index, Class requiredType)
index
- the index in the constructor argument listrequiredType
- the type to match (can be null
to match
untyped values only)
null
if none setpublic ConstructorArgumentValues.ValueHolder getIndexedArgumentValue(int index, Class requiredType, String requiredName)
index
- the index in the constructor argument listrequiredType
- the type to match (can be null
to match
untyped values only)requiredName
- the type to match (can be null
to match
unnamed values only)
null
if none setpublic Map<Integer,ConstructorArgumentValues.ValueHolder> getIndexedArgumentValues()
ConstructorArgumentValues.ValueHolder
public void addGenericArgumentValue(Object value)
Note: A single generic argument value will just be used once, rather than matched multiple times.
value
- the argument valuepublic void addGenericArgumentValue(Object value, String type)
Note: A single generic argument value will just be used once, rather than matched multiple times.
value
- the argument valuetype
- the type of the constructor argumentpublic void addGenericArgumentValue(ConstructorArgumentValues.ValueHolder newValue)
Note: A single generic argument value will just be used once, rather than matched multiple times.
newValue
- the argument value in the form of a ValueHolder
Note: Identical ValueHolder instances will only be registered once, to allow for merging and re-merging of argument value definitions. Distinct ValueHolder instances carrying the same content are of course allowed.
public ConstructorArgumentValues.ValueHolder getGenericArgumentValue(Class requiredType)
requiredType
- the type to match
null
if none setpublic ConstructorArgumentValues.ValueHolder getGenericArgumentValue(Class requiredType, String requiredName)
requiredType
- the type to matchrequiredName
- the name to match
null
if none setpublic ConstructorArgumentValues.ValueHolder getGenericArgumentValue(Class requiredType, String requiredName, Set<ConstructorArgumentValues.ValueHolder> usedValueHolders)
requiredType
- the type to match (can be null
to find
an arbitrary next generic argument value)requiredName
- the name to match (can be null
to not
match argument values by name)usedValueHolders
- a Set of ValueHolder objects that have already been used
in the current resolution process and should therefore not be returned again
null
if none foundpublic List<ConstructorArgumentValues.ValueHolder> getGenericArgumentValues()
ConstructorArgumentValues.ValueHolder
public ConstructorArgumentValues.ValueHolder getArgumentValue(int index, Class requiredType)
index
- the index in the constructor argument listrequiredType
- the type to match
null
if none setpublic ConstructorArgumentValues.ValueHolder getArgumentValue(int index, Class requiredType, String requiredName)
index
- the index in the constructor argument listrequiredType
- the type to matchrequiredName
- the name to match
null
if none setpublic ConstructorArgumentValues.ValueHolder getArgumentValue(int index, Class requiredType, String requiredName, Set<ConstructorArgumentValues.ValueHolder> usedValueHolders)
index
- the index in the constructor argument listrequiredType
- the type to match (can be null
to find
an untyped argument value)usedValueHolders
- a Set of ValueHolder objects that have already
been used in the current resolution process and should therefore not
be returned again (allowing to return the next generic argument match
in case of multiple generic argument values of the same type)
null
if none setpublic int getArgumentCount()
public boolean isEmpty()
public void clear()
public boolean equals(Object other)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |