public static Map < String , Object > validateAndBuildKeyValuesMap ( String listenAddresses , String port , String ssl , String sslCaFile , String sslCertFile , String sslKeyFile , String maxConnections , String sharedBuffers , String effectiveCacheSize , String autovacuum , String workMem ) { Map < String , Object > keyValues = new HashMap <> ( ) ; if ( listenAddresses != null && listenAddresses . length ( ) > 0 ) { keyValues . put ( LISTEN_ADDRESSES , listenAddresses ) ; } if ( StringUtils . isNumeric ( port ) ) { keyValues . put ( PORT , Integer . parseInt ( port ) ) ; } if ( StringUtils . isNotEmpty ( ssl ) ) { keyValues . put ( SSL , ssl ) ; } if ( StringUtils . isNotEmpty ( sslCaFile ) ) { keyValues . put ( SSL_CA_FILE , sslCaFile ) ; } if ( StringUtils . isNotEmpty ( sslCertFile ) ) { keyValues . put ( SSL_CERT_FILE , sslCertFile ) ; } if ( StringUtils . isNotEmpty ( sslKeyFile ) ) { keyValues . put ( SSL_KEY_FILE , sslKeyFile ) ; } if ( StringUtils . isNumeric ( maxConnections ) ) { keyValues . put ( MAX_CONNECTIONS , Integer . parseInt ( maxConnections ) ) ; } if ( StringUtils . isNotEmpty ( sharedBuffers ) ) { keyValues . put ( SHARED_BUFFERS , sharedBuffers ) ; } if ( StringUtils . isNotEmpty ( effectiveCacheSize ) ) { keyValues . put ( EFFECTIVE_CACHE_SIZE , effectiveCacheSize ) ; } if ( StringUtils . isNotEmpty ( autovacuum ) ) { keyValues . put ( AUTOVACUUM , autovacuum ) ; } if ( StringUtils . isNotEmpty ( workMem ) ) { keyValues . put ( WORK_MEM , workMem ) ; } return keyValues ; }
Method to validate inputs and consolidate to a map .