private Map < String , Class < ? > > getSqlDataTypes ( ) throws SQLException { if ( sqlDataTypes == null ) { // Load custom types from ServiceLoader Map < String , Class < ? > > newMap = new LinkedHashMap <> ( ) ; Iterator < SQLData > iter = ServiceLoader . load ( SQLData . class ) . iterator ( ) ; while ( iter . hasNext ( ) ) { SQLData sqlData = iter . next ( ) ; newMap . put ( sqlData . getSQLTypeName ( ) , sqlData . getClass ( ) ) ; } sqlDataTypes = newMap ; } return sqlDataTypes ; }
Loads the custom types when first needed and caches the results .