public <T> void setVariable(String key, T value) { setVariable(key, value, value.getClass()); }
@Override public String getAttribute(Element element, String attribute) { String expression = super.getAttribute(element, attribute); return elEngine.resolve(expression); }
void initialize(GlobalSettings globalSettings, ClassLoader classLoader) { if (globalSettings.isAutoregisterJMXBeans()) { // Register JMX MBeans. If an error occurs, don't propagate exception try { registerJMXBeans(new JMXPlatformImpl()); } catch (Throwable t) { log.warn("Unable to register Dozer JMX MBeans with the PlatformMBeanServer. Dozer will still function " + "normally, but management via JMX may not be available", t); } } BeanContainer beanContainer = BeanContainer.getInstance(); registerClassLoader(globalSettings, classLoader, beanContainer); registerProxyResolver(globalSettings, beanContainer); if (globalSettings.isElEnabled()) { ELEngine engine = new ELEngine(); engine.init(); beanContainer.setElEngine(engine); beanContainer.setElementReader(new ExpressionElementReader(engine)); } for (DozerModule module : ServiceLoader.load(DozerModule.class)) { module.init(); } }
public <T> void setVariable(String key, T value) { setVariable(key, value, value.getClass()); }
@Override public String getNodeValue(Element element) { String expression = super.getNodeValue(element); return elEngine.resolve(expression); }
private void parseVariables(Element element) { NodeList nl = element.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node node = nl.item(i); if (node instanceof Element) { Element ele = (Element) node; debugElement(ele); if (VARIABLE_ELEMENT.equals(ele.getNodeName())) { ELEngine engine = BeanContainer.getInstance().getElEngine(); if (engine != null) { String name = getAttribute(ele, NAME_ATTRIBUTE); String value = getNodeValue(ele); engine.setVariable(name, value); } } } } }
@Override public String getNodeValue(Element element) { String expression = super.getNodeValue(element); return elEngine.resolve(expression); }
private void parseVariables(Element element) { NodeList nl = element.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node node = nl.item(i); if (node instanceof Element) { Element ele = (Element) node; debugElement(ele); if (VARIABLE_ELEMENT.equals(ele.getNodeName())) { ELEngine engine = BeanContainer.getInstance().getElEngine(); if (engine != null) { String name = getAttribute(ele, NAME_ATTRIBUTE); String value = getNodeValue(ele); engine.setVariable(name, value); } } } } }
@Override public String getAttribute(Element element, String attribute) { String expression = super.getAttribute(element, attribute); return elEngine.resolve(expression); }
private void parseVariables(Element element) { NodeList nl = element.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node node = nl.item(i); if (node instanceof Element) { Element ele = (Element) node; debugElement(ele); if (VARIABLE_ELEMENT.equals(ele.getNodeName())) { ELEngine engine = BeanContainer.getInstance().getElEngine(); if (engine != null) { String name = getAttribute(ele, NAME_ATTRIBUTE); String value = getNodeValue(ele); engine.setVariable(name, value); } } } } }