@Test public void testSetBaseNamesAll() { ms.setBasenames("classpath*:languages/*messages.properties"); assertEquals("Ninja Message1", ms.getMessage("ninja.message1", null, Locale.getDefault())); }
@Override public void setBasenames(String... basenames) { List<String> names = new ArrayList<String>(); if (basenames != null) { for (int i = 0; i < basenames.length; i++) { Resource[] resources; try { resources = patternResolver.getResources(basenames[i]); String prefix = basenames[i].substring(0,basenames[i].indexOf('*')); if(basenames[i].startsWith("classpath*")) { prefix = basenames[i].substring(0, basenames[i].indexOf('*')) + basenames[i].substring(basenames[i].indexOf("*") + 1, basenames[i].lastIndexOf('*')); } for (int j=0; j< resources.length; j++) { String filename = resources[j].getFilename(); names.add(prefix + filename.replace(".properties","")); } } catch (IOException e) { _log.error("Failed to load resource for ["+basenames[i]+"].",e); } } } super.setBasenames(names.toArray(new String[names.size()])); }
PatternResourceBundleMessageSource extends ReloadableResourceBundleMessageSource { @Override public void setBasenames(String... basenames) { List<String> names = new ArrayList<String>(); if (basenames != null) { for (int i = 0; i < basenames.length; i++) { Resource[] resources; try { resources = patternResolver.getResources(basenames[i]); String prefix = basenames[i].substring(0,basenames[i].indexOf('*')); if(basenames[i].startsWith("classpath*")) { prefix = basenames[i].substring(0, basenames[i].indexOf('*')) + basenames[i].substring(basenames[i].indexOf("*") + 1, basenames[i].lastIndexOf('*')); } for (int j=0; j< resources.length; j++) { String filename = resources[j].getFilename(); names.add(prefix + filename.replace(".properties","")); } } catch (IOException e) { _log.error("Failed to load resource for ["+basenames[i]+"].",e); } } } super.setBasenames(names.toArray(new String[names.size()])); } }
PatternResourceBundleMessageSource extends ReloadableResourceBundleMessageSource { @Override public void setBasenames(String... basenames) { List<String> names = new ArrayList<String>(); if (basenames != null) { for (int i = 0; i < basenames.length; i++) { Resource[] resources; try { resources = patternResolver.getResources(basenames[i]); String prefix = basenames[i].substring(0,basenames[i].indexOf('*')); if(basenames[i].startsWith("classpath*")) { prefix = basenames[i].substring(0, basenames[i].indexOf('*')) + basenames[i].substring(basenames[i].indexOf("*") + 1, basenames[i].lastIndexOf('*')); } for (int j=0; j< resources.length; j++) { String filename = resources[j].getFilename(); names.add(prefix + filename.replace(".properties","")); } } catch (IOException e) { _log.error("Failed to load resource for ["+basenames[i]+"].",e); } } } super.setBasenames(names.toArray(new String[names.size()])); }  }
PatternResourceBundleMessageSource extends ReloadableResourceBundleMessageSource { @Override public void setBasenames(String... basenames) { List<String> names = new ArrayList<String>(); if (basenames != null) { for (int i = 0; i < basenames.length; i++) { Resource[] resources; try { resources = patternResolver.getResources(basenames[i]); String prefix = basenames[i].substring(0,basenames[i].indexOf('*')); if(basenames[i].startsWith("classpath*")) { prefix = basenames[i].substring(0, basenames[i].indexOf('*')) + basenames[i].substring(basenames[i].indexOf("*") + 1, basenames[i].lastIndexOf('*')); } for (int j=0; j< resources.length; j++) { String filename = resources[j].getFilename(); names.add(prefix + filename.replace(".properties","")); } } catch (IOException e) { _log.error("Failed to load resource for ["+basenames[i]+"].",e); } } } super.setBasenames(names.toArray(new String[names.size()])); }  @Override void setBasenames(String... basenames); }
PatternResourceBundleMessageSource extends ReloadableResourceBundleMessageSource { @Override public void setBasenames(String... basenames) { List<String> names = new ArrayList<String>(); if (basenames != null) { for (int i = 0; i < basenames.length; i++) { Resource[] resources; try { resources = patternResolver.getResources(basenames[i]); String prefix = basenames[i].substring(0,basenames[i].indexOf('*')); if(basenames[i].startsWith("classpath*")) { prefix = basenames[i].substring(0, basenames[i].indexOf('*')) + basenames[i].substring(basenames[i].indexOf("*") + 1, basenames[i].lastIndexOf('*')); } for (int j=0; j< resources.length; j++) { String filename = resources[j].getFilename(); names.add(prefix + filename.replace(".properties","")); } } catch (IOException e) { _log.error("Failed to load resource for ["+basenames[i]+"].",e); } } } super.setBasenames(names.toArray(new String[names.size()])); }  @Override void setBasenames(String... basenames);  }