Convert single char in String to lower case

后端 未结 7 1746
孤独总比滥情好
孤独总比滥情好 2021-01-17 10:15

I like to \'guess\' attribute names from getter methods. So \'getSomeAttribute\' shall be converted to \'someAttribute\'.

Usually I do something like



        
相关标签:
7条回答
  • 2021-01-17 11:16

    Have a look at the JavaBeans API:

    BeanInfo info = Introspector.getBeanInfo(bean
           .getClass(), Object.class);
    for (PropertyDescriptor propertyDesc : info
           .getPropertyDescriptors()) {
      String name = propertyDesc.getName();
    }
    

    Also see decapitalize.

    0 讨论(0)
提交回复
热议问题