Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.beans.factory.config
Class TypedStringValue

    java.lang.Object
      org.springframework.beans.factory.config.TypedStringValue

All Implemented Interfaces:
  BeanMetadataElement

    public class TypedStringValue

extends Object
implements BeanMetadataElement

Holder for a typed String value. Can be added to bean definitions in order to explicitly specify a target type for a String value, for example for collection elements.

This holder will just store the String value and the target type. The actual conversion will be performed by the bean factory.

Since:
  1.2
Author:
  Juergen Hoeller
See Also:
  `BeanDefinition.getPropertyValues()`, `MutablePropertyValues.addPropertyValue(org.springframework.beans.PropertyValue)`

Constructor Summary
`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.

Method Summary
`boolean` | `equals(Object other)`
`Object` | `getSource()` Return the configuration source `Object` for this metadata element (may be `null`).
`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 .
`Class` | `resolveTargetType(ClassLoader classLoader)` Determine the type to convert to, resolving it from a specified class name if necessary.
`void` | `setSource(Object source)` Set the configuration source `Object` for this metadata element.
`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()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### TypedStringValue

    public TypedStringValue(String value)

  Create a new `TypedStringValue` for the given String value.

  Parameters:
    `value` - the String value

### TypedStringValue

    public TypedStringValue(String value,
                            Class targetType)

  Create a new `TypedStringValue` for the given String value and target type.

  Parameters:
    `value` - the String value
    `targetType` - the type to convert to

### TypedStringValue

    public TypedStringValue(String value,
                            String targetTypeName)

  Create a new `TypedStringValue` for the given String value and target type.

  Parameters:
    `value` - the String value
    `targetTypeName` - the type to convert to

Method Detail

### setValue

    public void setValue(String value)

  Set the String value.

  Only necessary for manipulating a registered value, for example in BeanFactoryPostProcessors.

  See Also:
    `PropertyPlaceholderConfigurer`

### getValue

    public String getValue()

  Return the String value.

### setTargetType

    public void setTargetType(Class targetType)

  Set the type to convert to.

  Only necessary for manipulating a registered value, for example in BeanFactoryPostProcessors.

  See Also:
    `PropertyPlaceholderConfigurer`

### getTargetType

    public Class getTargetType()

  Return the type to convert to.

### setTargetTypeName

    public void setTargetTypeName(String targetTypeName)

  Specify the type to convert to.

### getTargetTypeName

    public String getTargetTypeName()

  Return the type to convert to.

### hasTargetType

    public boolean hasTargetType()

  Return whether this typed String value carries a target type .

### resolveTargetType

    public Class resolveTargetType(ClassLoader classLoader)
                            throws ClassNotFoundException

  Determine the type to convert to, resolving it from a specified class name if necessary. Will also reload a specified Class from its name when called with the target type already resolved.

  Parameters:
    `classLoader` - the ClassLoader to use for resolving a (potential) class name
  Returns:
    the resolved type to convert to
  Throws:
    `ClassNotFoundException` - if the type cannot be resolved

### setSource

    public void setSource(Object source)

  Set the configuration source `Object` for this metadata element.

  The exact type of the object will depend on the configuration mechanism used.

### getSource

    public Object getSource()

  Description copied from interface: `BeanMetadataElement`
  Return the configuration source `Object` for this metadata element (may be `null`).

  Specified by:
    `getSource` in interface `BeanMetadataElement`

### equals

    public boolean equals(Object other)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2008 The Spring Framework.