@Test public void train_symbols_expanded_and_types_coerced() { ComponentResources resources = mockComponentResources(); ComponentModel model = mockComponentModel(); SymbolSource symbolSource = mockSymbolSource(); ComponentModelSource modelSource = mockComponentModelSource(); String key = "foo.bar"; String value = "${zaphod}"; String expandedValue = "99"; String completeId = "foo.Bar:baz"; train_getCompleteId(resources, completeId); train_getComponentModel(resources, model); train_getMeta(model, key, value); train_expandSymbols(symbolSource, value, expandedValue); replay(); Map<String, String> configuration = Collections.emptyMap(); MetaDataLocator locator = new MetaDataLocatorImpl(symbolSource, typeCoercer, modelSource, configuration); assertEquals(locator.findMeta(key, resources, Integer.class), new Integer(99)); verify(); }
public <T> T findMeta(String key, final ComponentResources resources, Class<T> expectedType) { String value = getSymbolExpandedValueFromCache(key, resources.getCompleteId() + "/" + key, new ValueLocator() { public String valueForKey(String key) { return locate(key, resources); } }); return typeCoercer.coerce(value, expectedType); }
MetaDataLocatorImpl implements MetaDataLocator { public <T> T findMeta(String key, final ComponentResources resources, Class<T> expectedType) { String value = getSymbolExpandedValueFromCache(key, resources.getCompleteId() + "/" + key, new ValueLocator() { public String valueForKey(String key) { return locate(key, resources); } }); return typeCoercer.coerce(value, expectedType); } }
MetaDataLocatorImpl implements MetaDataLocator { public <T> T findMeta(String key, final ComponentResources resources, Class<T> expectedType) { String value = getSymbolExpandedValueFromCache(key, resources.getCompleteId() + "/" + key, new ValueLocator() { public String valueForKey(String key) { return locate(key, resources); } }); return typeCoercer.coerce(value, expectedType); } MetaDataLocatorImpl(SymbolSource symbolSource, TypeCoercer typeCoercer,
                               ComponentModelSource modelSource, Map<String, String> configuration); }
MetaDataLocatorImpl implements MetaDataLocator { public <T> T findMeta(String key, final ComponentResources resources, Class<T> expectedType) { String value = getSymbolExpandedValueFromCache(key, resources.getCompleteId() + "/" + key, new ValueLocator() { public String valueForKey(String key) { return locate(key, resources); } }); return typeCoercer.coerce(value, expectedType); } MetaDataLocatorImpl(SymbolSource symbolSource, TypeCoercer typeCoercer,
                               ComponentModelSource modelSource, Map<String, String> configuration); @PostInjection void setupInvalidation(@ComponentClasses InvalidationEventHub invalidationEventHub); T findMeta(String key, final ComponentResources resources, Class<T> expectedType); T findMeta(String key, final String pageName, Class<T> expectedType); }
MetaDataLocatorImpl implements MetaDataLocator { public <T> T findMeta(String key, final ComponentResources resources, Class<T> expectedType) { String value = getSymbolExpandedValueFromCache(key, resources.getCompleteId() + "/" + key, new ValueLocator() { public String valueForKey(String key) { return locate(key, resources); } }); return typeCoercer.coerce(value, expectedType); } MetaDataLocatorImpl(SymbolSource symbolSource, TypeCoercer typeCoercer,
                               ComponentModelSource modelSource, Map<String, String> configuration); @PostInjection void setupInvalidation(@ComponentClasses InvalidationEventHub invalidationEventHub); T findMeta(String key, final ComponentResources resources, Class<T> expectedType); T findMeta(String key, final String pageName, Class<T> expectedType);  }