@Override public Express bind(String name, Object value) { context.put(name, value); return this; }
OgnlContext createContext(final Map<String, Object> vars) { OgnlContext ognlContext = new OgnlContext(); ognlContext.putAll(vars); ognlContext.put("logger", log); return ognlContext; }
@Override public Express bind(String name, Object value) { context.put(name, value); return this; }
public void bind(Object value) { bindings.put("_", value); }
protected void setValueBody(OgnlContext context, Object target, Object value) throws OgnlException { context.put(_name, value); }
public String getSourceAccessor(OgnlContext context, Object target, Object name) { context.put("_noRoot", "true"); return "com.webobjects.foundation.NSKeyValueCoding.Utility#valueForKey($2, " + name + ")"; }
protected void setValueBody(OgnlContext context, Object target, Object value) throws OgnlException { context.put(_name, value); }
public String getSourceSetter(OgnlContext context, Object target, Object name) { if (target instanceof NSValidation) return ".validateTakeValueForKeyPath($3," + name + ")"; context.put("_noRoot", "true"); return "com.webobjects.foundation.NSKeyValueCoding.Utility#takeValueForKey($2,$3," + name + ")"; } }
public void bind(Object value) { bindings.put("_", value); }
protected void setValueBody( OgnlContext context, Object target, Object value ) throws OgnlException { context.put( name, value ); }
public void putAll(Map t) { for (Object k : t.keySet()) { put(k, t.get(k)); } }
public void putAll(Map t) { for (Object k : t.keySet()) { put(k, t.get(k)); } }
public void putAll(Map t) { for (Iterator it = t.keySet().iterator(); it.hasNext();) { Object k = it.next(); put(k, t.get(k)); } }
public void startContext(String name, Type type, Object root, ResourceBundle bundle) { OgnlContext context = createOgnlContext(root); context.setTraceEvaluations(true); context.put("rootType", type); context.put("removal", removal); context.put("nullHandler", nullHandler()); context.put(ResourceBundle.class, bundle); context.put("proxifier", proxifier); Ognl.setTypeConverter(context, createAdapter(bundle)); contexts.put(name, context); }
private void putVariable(String rawVariableName, Object value) { Check.isFalse(rawVariableName.startsWith("#"), "Variable name passed to evaluator should not start with #"); Check.isTrue(!rawVariableName.equals("in"), "'%s' is a reserved word and cannot be used for variables names", rawVariableName); ognlContext.put(rawVariableName, value); }
private void putVariable(String rawVariableName, Object value) { Check.isFalse(rawVariableName.startsWith("#"), "Variable name passed to evaluator should not start with #"); Check.isTrue(!rawVariableName.equals("in"), "'%s' is a reserved word and cannot be used for variables names", rawVariableName); ognlContext.put(rawVariableName, value); }
MultiKeyMap keyMap = new MultiKeyMap();//MultiKeyMap Creation keyMap.put("1","2","OneTwo");//storing value OgnlContext context = new OgnlContext();// Ognl Context context.put("vap", keyMap); Object expression = Ognl.parseExpression("vap.get(\"1\",\"2\")");// Ognl expression //to retrive value from multikeyMap System.out.println(Ognl.getValue(expression, context));//Printing value.
protected Object evaluate(Object o, ResourcePropertyMapping resourcePropertyMapping) throws ConversionException { OgnlContext ctx = new OgnlContext(); ctx.put(DATA_CONTEXT_KEY, o); try { return Ognl.getValue(expression, ctx, o); } catch (Exception e) { throw new ConversionException("Failed to evaluate [" + o + "] with expression [" + expression + "]", e); } } }
@Before public void setup() throws Exception { MockitoAnnotations.initMocks(this); AbstractOgnlTestSupport.configOgnl(converters); this.proxifier = new JavassistProxifier(new ReflectionInstanceCreator()); this.context = (OgnlContext) Ognl.createDefaultContext(null); context.setTraceEvaluations(true); context.put("removal", removal); context.put("nullHandler", new GenericNullHandler(removal)); context.put("proxifier", proxifier); when(container.instanceFor(Converters.class)).thenReturn(converters); when(converters.to(String.class)).thenReturn(new StringConverter()); when(converters.to(Long.class)).thenReturn(new LongConverter()); }
@Before public void setup() { MockitoAnnotations.initMocks(this); client = new Client(); handler = new ListNullHandler(removal); context = (OgnlContext) Ognl.createDefaultContext(null); context.put("proxifier", new JavassistProxifier(new ReflectionInstanceCreator())); }