/** * Returns a copy of this bundle with a different configuration. * <p> * This does not reload the underlying resources. * * @param config the new config, not null * @return a bundle with the config updated, not null */ public ElSql withConfig(ElSqlConfig config) { return new ElSql(_fragments.withConfig(config)); }
/** * Parses a bundle from a resource locating a file, specify the config. * <p> * This parses a list of resources, expressed as {@code URL}s. * Named blocks in later resources override blocks with the same name in earlier resources. * <p> * The config is designed to handle some, but not all, database differences. * Other differences are handled via the override resources passed in. * <p> * Each resource is a {@link URL}. A null URL is permitted and ignored. * This allows classpath resources, obtained from {@link Class#getResource(String)} * or {@link ClassLoader#getResource(String)} to be called and passed in directly * as those methods return null when the target does not exist. * * @param config the config to use, not null * @param resources the resources to load, not null, may contain nulls which are ignored * @return the external identifier, not null * @throws IllegalArgumentException if the input cannot be parsed or if none of the resources exists */ public static ElSql parse(ElSqlConfig config, URL... resources) { if (config == null) { throw new IllegalArgumentException("Config must not be null"); } if (resources == null) { throw new IllegalArgumentException("Resources must not be null"); } return new ElSql(SqlFragments.parseResource(resources, config)); }