-
- All Implemented Interfaces:
public class BeanProxy.BeanInstance<B>
-
-
Constructor Summary
Constructors Constructor Description BeanProxy.BeanInstance(B instance, BeanProxy<B> proxy)BeanProxy.BeanInstance(B instance, BeanProxy<B> proxy, Class<out Object> clazz)
-
Method Summary
Modifier and Type Method Description BeanProxy.BeanInstance<B>setProperty(@NotNull() String db_field_name, @Nullable() Object value)设置一个属性,该方法不会自动转换value的类型。 如代理对象的`id`是`Long`或者`Int`类型,现在有一个`BigDecimal`类型的值,如何将这个`BigDecimal`设置到`id`上呢? 参考如下代码:
```java ```BeanInstance<Object> instance = BeanProxy.fromBean(bean); String field_name = "id"; Object typedValue = new ObjectMapper().convertValue(bigDecimalId, instance.getPropertyType(field_name)); instance.setProperty(field_name, typedValue);ObjectgetProperty(@NotNull() String db_field_name)get Class<out Object>getPropertyType(@NotNull() String db_field_name)获取某属性的类型 BtoBean()获取bean Class<B>getBeanType()获取bean的类型 ClassParser.ParsedClassgetParsedClass()Iterator<Map.Entry<String, Object>>iterator()以Map. -
-
Method Detail
-
setProperty
@NotNull() BeanProxy.BeanInstance<B> setProperty(@NotNull() String db_field_name, @Nullable() Object value)
设置一个属性,该方法不会自动转换value的类型。 如代理对象的`id`是`Long`或者`Int`类型,现在有一个`BigDecimal`类型的值,如何将这个`BigDecimal`设置到`id`上呢? 参考如下代码:
```java ```BeanInstance<Object> instance = BeanProxy.fromBean(bean); String field_name = "id"; Object typedValue = new ObjectMapper().convertValue(bigDecimalId, instance.getPropertyType(field_name)); instance.setProperty(field_name, typedValue);
-
getProperty
@Nullable() Object getProperty(@NotNull() String db_field_name)
get
-
getPropertyType
@Nullable() Class<out Object> getPropertyType(@NotNull() String db_field_name)
获取某属性的类型
-
getBeanType
Class<B> getBeanType()
获取bean的类型
-
getParsedClass
ClassParser.ParsedClass getParsedClass()
-
-
-
-