private void add_snake_case_properties ( List < PropertyDescriptor > pdl ) throws IntrospectionException { List < PropertyDescriptor > alternatives = new ArrayList < PropertyDescriptor > ( ) ; for ( PropertyDescriptor descriptor : pdl ) { String camelCase = descriptor . getName ( ) ; if ( camelCase . equals ( "rendererType" ) ) { continue ; } if ( camelCase . equals ( "localValueSet" ) ) { continue ; } if ( camelCase . equals ( "submittedValue" ) ) { continue ; } String snake_case = BsfUtils . camelCaseToSnakeCase ( camelCase ) ; if ( snake_case != camelCase ) { // in this particular case, we don't // need to use equals! if ( descriptor . getReadMethod ( ) != null && descriptor . getWriteMethod ( ) != null ) { String getter = descriptor . getReadMethod ( ) . getName ( ) ; String setter = descriptor . getWriteMethod ( ) . getName ( ) ; if ( UIComponent . class != descriptor . getReadMethod ( ) . getDeclaringClass ( ) ) { PropertyDescriptor alternative = new PropertyDescriptor ( snake_case , getDecoratedClass ( ) , getter , setter ) ; alternative . setBound ( true ) ; alternatives . add ( alternative ) ; // more alternatives if ( camelCase . equals ( "styleClass" ) ) { alternative = new PropertyDescriptor ( "class" , getDecoratedClass ( ) , getter , setter ) ; alternative . setBound ( true ) ; alternatives . add ( alternative ) ; } } } } } if ( alternatives . size ( ) > 0 ) { pdl . addAll ( alternatives ) ; } }
Method that generates dynamically the snake - case methods from the available camelcase properties found inside the bean list .