return LazyMap.lazyMap(map, factory);
return LazyMap.lazyMap(map, transformerFactory);
/** * The lazy Map creates messages objects with a fall back to the default locale. */ protected void initMap() { // LazyMap will instantiate bundles on demand. final Map map = LazyMap.lazyMap(new HashMap(), new Transformer() { // this transformer will wrap the Messages in a MessagesChain which // will fall back to a Messages instance for the same bundle with // default locale. @Override public Object transform(Object input) { final MessagesID id = (MessagesID) input; return newMessages(id); } }); messages = Collections.synchronizedMap(map); }
protected static Map<String, Object> prepareParams(Map<String, ?> parameterValues) { Map<String, Object> parameterValuesWithStats = new HashMap<>(parameterValues); BeansWrapper beansWrapper = new BeansWrapperBuilder(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS).build(); parameterValuesWithStats.put("statics", beansWrapper.getStaticModels()); @SuppressWarnings("unchecked") Map<String, Object> params = LazyMap.lazyMap(parameterValuesWithStats, propertyName -> { for (String appProperty : AppContext.getPropertyNames()) { if (appProperty.replace(".", "_").equals(propertyName)) { return AppContext.getProperty(propertyName); } } return null; }); return params; } }