Class BeanUtil


  • public final class BeanUtil
    extends Object
    Some simple bean introspection methods. To avoid a dependency on the awt java.beans.introspector which is a desktop level class.
    • Constructor Detail

      • BeanUtil

        private BeanUtil()
    • Method Detail

      • getterName

        public static String getterName​(String fieldName,
                                        Class<?> type)
        Calculate the name of a getter based on the name of it's field and the type
        Parameters:
        fieldName - of the field
        type - of the field
        Returns:
        "get" or "is" method name for the field
      • setterName

        public static String setterName​(String fieldName)
        Calculate the name of a setter based on the name of it's field
        Parameters:
        fieldName - of the field
        Returns:
        "set" method name for the field
      • capitalize

        public static String capitalize​(String fieldName)
        capitalize according to java beans specification
      • decapitalize

        public static String decapitalize​(String name)
        decapitalize according to java beans specification. That is start the given field with a lower case, but only if the 2nd char is not also an uppercase character. eg; "Enabled" will become "enabled", but "URL" will remain "URL".