open class FieldRetrievingFactoryBean : FactoryBean<Any>, BeanNameAware, BeanClassLoaderAware, InitializingBean
FactoryBean which retrieves a static or non-static field value.
Typically used for retrieving public static final constants. Usage example:
// standard definition for exposing a static field, specifying the "staticField" property <bean id="myField" class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean"> <property name="staticField" value="java.sql.Connection.TRANSACTION_SERIALIZABLE"/> </bean> // convenience version that specifies a static field pattern as bean name <bean id="java.sql.Connection.TRANSACTION_SERIALIZABLE" class="org.springframework.beans.factory.config.FieldRetrievingFactoryBean"/>
If you are using Spring 2.0, you can also use the following style of configuration for public static fields.
<util:constant static-field="java.sql.Connection.TRANSACTION_SERIALIZABLE"/>
Author
Juergen Hoeller
Since
1.1
See Also
#setStaticField
FieldRetrievingFactoryBean()
FactoryBean which retrieves a static or non-static field value. Typically used for retrieving public static final constants. Usage example:
If you are using Spring 2.0, you can also use the following style of configuration for public static fields.
|
open fun afterPropertiesSet(): Unit |
|
open fun getObject(): Any |
|
open fun getObjectType(): Class<*> |
|
open fun getTargetClass(): Class<*>
Return the target class on which the field is defined. |
|
open fun getTargetField(): String
Return the name of the field to be retrieved. |
|
open fun getTargetObject(): Any
Return the target object on which the field is defined. |
|
open fun isSingleton(): Boolean |
|
open fun setBeanClassLoader(classLoader: ClassLoader): Unit |
|
open fun setBeanName(beanName: String): Unit
The bean name of this FieldRetrievingFactoryBean will be interpreted as "staticField" pattern, if neither "targetClass" nor "targetObject" nor "targetField" have been specified. This allows for concise bean definitions with just an id/name. |
|
open fun setStaticField(staticField: String): Unit
Set a fully qualified static field name to retrieve, e.g. "example.MyExampleClass.MY_EXAMPLE_FIELD". Convenient alternative to specifying targetClass and targetField. |
|
open fun setTargetClass(targetClass: Class<*>): Unit
Set the target class on which the field is defined. Only necessary when the target field is static; else, a target object needs to be specified anyway. |
|
open fun setTargetField(targetField: String): Unit
Set the name of the field to be retrieved. Refers to either a static field or a non-static field, depending on a target object being set. |
|
open fun setTargetObject(targetObject: Any): Unit
Set the target object on which the field is defined. Only necessary when the target field is not static; else, a target class is sufficient. |