use of cn.taketoday.beans.BeanProperty in project today-infrastructure by TAKETODAY.
the class TypeDescriptorTests method nestedPropertyTypeMapTwoLevels.
@Test
public void nestedPropertyTypeMapTwoLevels() throws Exception {
final BeanProperty property = BeanProperty.valueOf(getClass(), "test4");
TypeDescriptor t1 = TypeDescriptor.nested(property.getField(), 2);
assertThat(t1.getType()).isEqualTo(String.class);
}
use of cn.taketoday.beans.BeanProperty in project today-infrastructure by TAKETODAY.
the class TypeDescriptorTests method propertyComplex.
@Test
public void propertyComplex() throws Exception {
BeanProperty complexProperty = BeanProperty.valueOf(getClass(), "complexProperty");
TypeDescriptor desc = complexProperty.getTypeDescriptor();
assertThat(desc.getMapKeyDescriptor().getType()).isEqualTo(String.class);
assertThat(desc.getMapValueDescriptor().getElementDescriptor().getElementDescriptor().getType()).isEqualTo(Integer.class);
}
use of cn.taketoday.beans.BeanProperty in project today-infrastructure by TAKETODAY.
the class TypeDescriptorTests method propertyGenericType.
@Test
void propertyGenericType() throws Exception {
GenericType<Integer> genericBean = new IntegerType();
BeanProperty property = BeanProperty.valueOf(genericBean.getClass().getMethod("getProperty"), genericBean.getClass().getMethod("setProperty", Integer.class));
TypeDescriptor desc = property.getTypeDescriptor();
assertThat(desc.getType()).isEqualTo(Integer.class);
}
use of cn.taketoday.beans.BeanProperty in project today-infrastructure by TAKETODAY.
the class TypeDescriptorTests method propertyGenericTypeList.
@Test
void propertyGenericTypeList() throws Exception {
GenericType<Integer> genericBean = new IntegerType();
BeanProperty property = BeanProperty.valueOf(genericBean.getClass().getMethod("getListProperty"), genericBean.getClass().getMethod("setListProperty", List.class));
TypeDescriptor desc = property.getTypeDescriptor();
assertThat(desc.getType()).isEqualTo(List.class);
assertThat(desc.getElementDescriptor().getType()).isEqualTo(Integer.class);
}
use of cn.taketoday.beans.BeanProperty in project today-infrastructure by TAKETODAY.
the class TypeDescriptorTests method propertyGenericClassList.
@Test
void propertyGenericClassList() throws Exception {
IntegerClass genericBean = new IntegerClass();
BeanProperty property = BeanProperty.valueOf(genericBean.getClass().getMethod("getListProperty"), genericBean.getClass().getMethod("setListProperty", List.class), IntegerClass.class);
TypeDescriptor desc = property.getTypeDescriptor();
assertThat(desc.getType()).isEqualTo(List.class);
assertThat(desc.getElementDescriptor().getType()).isEqualTo(Integer.class);
assertThat(desc.getAnnotation(MethodAnnotation1.class)).isNotNull();
assertThat(desc.hasAnnotation(MethodAnnotation1.class)).isTrue();
}
Aggregations