public class TypedStringValue extends Object implements BeanMetadataElement
This holder will just store the String value and the target type. The actual conversion will be performed by the bean factory.
BeanDefinition.getPropertyValues()
,
MutablePropertyValues.addPropertyValue(org.springframework.beans.PropertyValue)
Constructor and Description |
---|
TypedStringValue(String value)
Create a new
TypedStringValue for the given String value. |
TypedStringValue(String value,
Class<?> targetType)
Create a new
TypedStringValue for the given String value
and target type. |
TypedStringValue(String value,
String targetTypeName)
Create a new
TypedStringValue for the given String value
and target type. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
Object |
getSource()
Return the configuration source
Object for this metadata element
(may be null ). |
String |
getSpecifiedTypeName()
Return the type name as actually specified for this particular value, if any.
|
Class<?> |
getTargetType()
Return the type to convert to.
|
String |
getTargetTypeName()
Return the type to convert to.
|
String |
getValue()
Return the String value.
|
int |
hashCode() |
boolean |
hasTargetType()
Return whether this typed String value carries a target type .
|
boolean |
isDynamic()
Return whether this value has been marked as dynamic.
|
Class<?> |
resolveTargetType(ClassLoader classLoader)
Determine the type to convert to, resolving it from a specified class name
if necessary.
|
void |
setDynamic()
Mark this value as dynamic, i.e.
|
void |
setSource(Object source)
Set the configuration source
Object for this metadata element. |
void |
setSpecifiedTypeName(String specifiedTypeName)
Set the type name as actually specified for this particular value, if any.
|
void |
setTargetType(Class<?> targetType)
Set the type to convert to.
|
void |
setTargetTypeName(String targetTypeName)
Specify the type to convert to.
|
void |
setValue(String value)
Set the String value.
|
String |
toString() |
public TypedStringValue(@Nullable String value)
TypedStringValue
for the given String value.value
- the String valuepublic TypedStringValue(@Nullable String value, Class<?> targetType)
TypedStringValue
for the given String value
and target type.value
- the String valuetargetType
- the type to convert topublic TypedStringValue(@Nullable String value, String targetTypeName)
TypedStringValue
for the given String value
and target type.value
- the String valuetargetTypeName
- the type to convert topublic void setValue(@Nullable String value)
Only necessary for manipulating a registered value, for example in BeanFactoryPostProcessors.
public void setTargetType(Class<?> targetType)
Only necessary for manipulating a registered value, for example in BeanFactoryPostProcessors.
public Class<?> getTargetType()
public void setTargetTypeName(@Nullable String targetTypeName)
public boolean hasTargetType()
@Nullable public Class<?> resolveTargetType(@Nullable ClassLoader classLoader) throws ClassNotFoundException
classLoader
- the ClassLoader to use for resolving a (potential) class nameClassNotFoundException
- if the type cannot be resolvedpublic void setSource(@Nullable Object source)
Object
for this metadata element.
The exact type of the object will depend on the configuration mechanism used.
@Nullable public Object getSource()
BeanMetadataElement
Object
for this metadata element
(may be null
).getSource
in interface BeanMetadataElement
public void setSpecifiedTypeName(@Nullable String specifiedTypeName)
@Nullable public String getSpecifiedTypeName()
public void setDynamic()
public boolean isDynamic()