从spring reference 中摘过来的哦。
Company.java
public class Company {
private String name;
private Employee managingDirector;
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public Employee getManagingDirector() {
return this.managingDirector;
}
public void setManagingDirector(Employee managingDirector) {
this.managingDirector = managingDirector;
}
}
Employee.java
public class Employee {
private String name;
private float salary;
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public float getSalary() {
return salary;
}
public void setSalary(float salary) {
this.salary = salary;
}
}
Test.java
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.beans.PropertyValue;
public class Test {
public static void main(String [] args ){
BeanWrapper company = new BeanWrapperImpl(new Company());
// setting the company name..
company.setPropertyValue("name", "Some Company Inc.");
// ... can also be done like this:
PropertyValue value = new PropertyValue("name", "Some Company Inc.");
company.setPropertyValue(value);
// ok, let's create the director and tie it to the company:
BeanWrapper jim =new BeanWrapperImpl(new Employee());
jim.setPropertyValue("name", "Jim Stravinsky");
company.setPropertyValue("managingDirector", jim.getWrappedInstance());
// retrieving the salary of the managingDirector through the company
Float salary = (Float) company.getPropertyValue("managingDirector.salary");
}
}
分享到:
相关推荐
Aliasing a bean outside the bean definition ................................................ 28 Instantiating beans .......................................................................................
Aliasing a bean outside the bean definition ................................................ 28 Instantiating beans .......................................................................................
Generative Visual Manipulation on the Natural Image Manifold论文介绍,笔记
nslations as Manipulation and Rewriting- Comparing the Different Translations-论文.zip
With the knowledge you gain from this book, you will quickly learn pandas and how it can empower you in the exciting world of data manipulation, analysis and science. What you will learn Understand ...
Robotic Grasping and Fine Manipulation
Drag Your GAN: Interactive Point-based Manipulation on the Generative Image Manifold github:https://github.com/XingangPan/DragGAN
demonstrate File I/O, user input, and output manipulation Design Consider the following questions: - What input will you prompt from the user? - What potentially bad input could the user enter? - What...
fuzzy systems and neural networks, biomedical applications, autonomous land, sea and air vehicles, localization, tracking, SLAM, 3D perception, manipulation with multifinger hands, robotics, micro/...
By the end of this book, you will have learned about text manipulation using stringr, how to extract data from twitter using twitteR library, how to clean raw data, and how to structure your raw data ...
李泽湘 运动学 动力学求解This chapter presents an introduction to the dynamics and control of robot manipulators. We derive the equations of motion for a general open-chain manipulator and, using the ...
薄膜矫顽力和磁各向异性方向的电场调控,项俊森,叶军,确定组分和结构磁性材料的热稳性与其各向异性能密切相关。结合信息写入和热稳定性两个方面,改善材料的各向异性和矫顽力,可以有
这本书是公认的机器人的必读名著之一,非常好的
A Mathematical Introduction to Robotic Manipulation Richard M. Murray, Zexiang Li and S. Shankar Sastry
Data Manipulation with R, is aimed at giving intermediate-to-advanced level users of R (who have knowledge about datasets) an opportunity to use state-of-the-art approaches in data manipulation....
input/output, memory management, string manipulation, and the like. Instead, these fa- cilities are defined in a standard library, which you compile and link with your programs. The GNU C library, ...
CBitmapEx - Free C++ Bitmap Manipulation Class the 'simple' C++ bitmap manipulation class called CBitmapEx
Wolfgang Engel’s GPU Pro 360 Guide to Geometry Manipulation gathers all the cutting-edge information from his previous seven GPU Pro volumes into a convenient single source anthology that covers ...
A comprehensive overview of data science covering the analytics, programming, and business skills necessary to master the discipline Finding a good data scientist has been likened to hunting for a ...