public static String convertDotToUnderscore ( String dottedProperty , boolean uppercase ) { if ( dottedProperty == null ) { return dottedProperty ; } Optional < String > converted = Optional . of ( dottedProperty ) . map ( value -> value . replace ( ' ' , ' ' ) ) . map ( value -> uppercase ? value . toUpperCase ( ) : value ) ; return converted . get ( ) ; }
Replace the dots in the property with underscore and transform to uppercase based on given flag .