@ Override public JdbcDatabaseDescriptor dbByName ( final String dbName ) { Collection < H2DatabaseWorking > select = CollectionUtils . select ( dbsw , new Predicate < H2DatabaseWorking > ( ) { @ Override public boolean evaluate ( H2DatabaseWorking db ) { return dbName . equals ( db . getName ( ) ) ; } } ) ; if ( CollectionUtils . size ( select ) == 0 ) { throw new IllegalArgumentException ( "There are no databases called '" + dbName + "'" ) ; } if ( CollectionUtils . size ( select ) >= 2 ) { throw new IllegalArgumentException ( "More than one database is called '" + dbName + "'" ) ; } return CollectionUtils . extractSingleton ( select ) ; }
Get a database by its name .