@Override protected String resolvePlaceholder(String placeholder, Properties props) { try { return symbolSource.valueForSymbol(placeholder); } catch(RuntimeException e) { return super.resolvePlaceholder(placeholder, props); } }
private String getSymbolExpandedValueFromCache(String key, String cacheKey, ValueLocator valueLocator) { if (cache.containsKey(cacheKey)) return cache.get(cacheKey); String value = valueLocator.valueForKey(key); if (value == null) { value = symbolSource.valueForSymbol(key); } else { value = symbolSource.expandSymbols(value); } cache.put(cacheKey, value); return value; }
public String map(String element) { return symbolSource.expandSymbols(element); } };
@Override public String transform(String input) { return symbolSource.expandSymbols(input); } }
@Override protected String resolvePlaceholder(String placeholder, Properties props) { try { return symbolSource.valueForSymbol(placeholder); } catch(RuntimeException e) { return super.resolvePlaceholder(placeholder, props); } }
protected final void train_expandSymbols(SymbolSource source, String input, String expanded) { expect(source.expandSymbols(input)).andReturn(expanded); }
public Binding newBinding(String description, ComponentResources container, ComponentResources component, String expression, Location location) { String value = symbolSource.valueForSymbol(expression); return new LiteralBinding(location, description, value); }
public Asset getExpandedAsset(String path) { return getUnlocalizedAsset(symbolSource.expandSymbols(path)); }
public DateFormat coerce(String input) { final SimpleDateFormat dateFormat = new SimpleDateFormat(input, threadLocale.getLocale()); final String lenient = objectLocator.getService(SymbolSource.class).valueForSymbol(SymbolConstants.LENIENT_DATE_FORMAT); dateFormat.setLenient(Boolean.parseBoolean(lenient)); return dateFormat; } }));
protected final void train_expandSymbols(SymbolSource source, String input, String expanded) { expect(source.expandSymbols(input)).andReturn(expanded); }
protected final void train_valueForSymbol(SymbolSource symbolSource, String symbolName, String value) { expect(symbolSource.valueForSymbol(symbolName)).andReturn(value).atLeastOnce(); }
@Override public String upcase(String input) { return source.expandSymbols(input).toUpperCase(); } };
protected final void train_valueForSymbol(SymbolSource symbolSource, String symbolName, String value) { expect(symbolSource.valueForSymbol(symbolName)).andReturn(value).atLeastOnce(); }
@Override public String expandSymbols(String input) { lock.check(); // Again, a bit of work to avoid instantiating the SymbolSource until absolutely necessary. if (!InternalUtils.containsSymbols(input)) return input; return getSymbolSource().expandSymbols(input); }
public List<Asset> getJavaScriptLibraries() { String jQueryUIPath = symbolSource.valueForSymbol(JQuerySymbolConstants.JQUERY_UI_PATH); if ( ! jQueryUIPath.endsWith("/")) { jQueryUIPath += "/"; } final List<Asset> javaScriptStack = new ArrayList<Asset>(); javaScriptStack.add(assetSource.getClasspathAsset(String.format("%s/datepicker.js", jQueryUIPath))); final Asset datePickerI18nAsset = getLocaleAsset(threadLocale.getLocale(), jQueryUIPath); if (includeDatePickerI18N && datePickerI18nAsset != null) { javaScriptStack.add(datePickerI18nAsset); } javaScriptStack.add(assetSource.getExpandedAsset("${assets.path}/components/datefield/datefield.js")); return javaScriptStack; }
@Override public String expandSymbols(String input) { lock.check(); // Again, a bit of work to avoid instantiating the SymbolSource until absolutely necessary. if (!InternalUtils.containsSymbols(input)) return input; return getSymbolSource().expandSymbols(input); }
source.valueForSymbol(SymbolConstants.APPLICATION_VERSION), registryCreatedTime - startTime, toFinish - startTime); String version = source.valueForSymbol(SymbolConstants.TAPESTRY_VERSION); boolean productionMode = Boolean.parseBoolean(source.valueForSymbol(SymbolConstants.PRODUCTION_MODE));
String expanded = symbolSource.expandSymbols(path);
@Test(dataProvider = "testers") public void application_path_is_defined_as_a_symbol(PageTester tester) { SymbolSource source = tester.getRegistry().getService(SymbolSource.class); assertEquals(source.valueForSymbol(InternalSymbols.APP_PACKAGE_PATH), "org/apache/tapestry5/integration/app2"); } }
/** * Provides the asset. If the expression does not identify an asset domain, with a prefix, it is assumed to be a * path on the classpath, relative to the root of the classpath. * * @param objectType the type of object (which must be Object or Asset) * @param locator not used */ public <T> T provide(Class<T> objectType, AnnotationProvider annotationProvider, ObjectLocator locator) { Path path = annotationProvider.getAnnotation(Path.class); if (path == null) return null; String expanded = symbolSource.expandSymbols(path.value()); Asset asset = source.getAsset(null, expanded, null); return typeCoercer.coerce(asset, objectType); } }