Example usage for org.springframework.beans TypeConverterDelegate TypeConverterDelegate

List of usage examples for org.springframework.beans TypeConverterDelegate TypeConverterDelegate

Introduction

In this page you can find the example usage for org.springframework.beans TypeConverterDelegate TypeConverterDelegate.

Prototype

public TypeConverterDelegate(PropertyEditorRegistrySupport propertyEditorRegistry,
        @Nullable Object targetObject) 

Source Link

Document

Create a new TypeConverterDelegate for the given editor registry and bean instance.

Usage

From source file:org.springframework.beans.AbstractNestablePropertyAccessor.java

/**
 * Switch the target object, replacing the cached introspection results only
 * if the class of the new object is different to that of the replaced object.
 * @param object the new target object/*  w  w  w  .  j av a2s  . com*/
 * @param nestedPath the nested path of the object
 * @param rootObject the root object at the top of the path
 */
public void setWrappedInstance(Object object, @Nullable String nestedPath, @Nullable Object rootObject) {
    this.wrappedObject = ObjectUtils.unwrapOptional(object);
    Assert.notNull(this.wrappedObject, "Target object must not be null");
    this.nestedPath = (nestedPath != null ? nestedPath : "");
    this.rootObject = (!"".equals(this.nestedPath) ? rootObject : this.wrappedObject);
    this.nestedPropertyAccessors = null;
    this.typeConverterDelegate = new TypeConverterDelegate(this, this.wrappedObject);
}

From source file:org.springframework.beans.BeanWrapperImpl.java

/**
 * Switch the target object, replacing the cached introspection results only
 * if the class of the new object is different to that of the replaced object.
 * @param object the new target object/*from   w w  w .  j  ava  2s  .  co  m*/
 * @param nestedPath the nested path of the object
 * @param rootObject the root object at the top of the path
 */
public void setWrappedInstance(Object object, String nestedPath, Object rootObject) {
    Assert.notNull(object, "Bean object must not be null");
    if (object.getClass().equals(javaUtilOptionalClass)) {
        this.object = OptionalUnwrapper.unwrap(object);
    } else {
        this.object = object;
    }
    this.nestedPath = (nestedPath != null ? nestedPath : "");
    this.rootObject = (!"".equals(this.nestedPath) ? rootObject : this.object);
    this.nestedBeanWrappers = null;
    this.typeConverterDelegate = new TypeConverterDelegate(this, this.object);
    setIntrospectionClass(this.object.getClass());
}