FastPropertyDescriptor可以快速的对实体类的get、set方法进行反射调用,速度接近于直接使用代码调用,可以代替Java自带的反射方法
TestEntity testEntity = new TestEntity();
// it's an example of how to initialise a AccessMethod for TestEntity
AccessMethod accessMethod = AccessMethodFactory.build(TestEntity.class)
// it's an example of how to use method set
accessMethod.set(testEntity, "property1", "It's a test value");
// it's an example of how to use method get
String testValue = (String)accessMethod.get(testEntity, "property1");
// or
String testValue = accessMethod.get(testEntity, "property1", String.class);
由于本项目采用字节码方式生成每个实体类对应的反射类,所以首次调用某个实体类的get或set方法时会占用少量时间对这个类进行初始化(消耗的时间和类中属性的数量有关),之后的速度接近于直接调用get与set方法