public static Validator validKeyStoreType ( ) { return ( s , o ) -> { if ( ! ( o instanceof String ) ) { throw new ConfigException ( s , o , "Must be a string." ) ; } String keyStoreType = o . toString ( ) ; try { KeyStore . getInstance ( keyStoreType ) ; } catch ( KeyStoreException e ) { ConfigException exception = new ConfigException ( s , o , "Invalid KeyStore type" ) ; exception . initCause ( e ) ; throw exception ; } } ; }
Validator is used to ensure that the KeyStore type specified is valid .