Object res = Ognl.getValue(object, context, context.getRoot(), valueType); return (T) res;
protected Object getValueBody(OgnlContext context, Object source) throws OgnlException { return context.getRoot(); }
protected Object getValueBody( OgnlContext context, Object source ) throws OgnlException { return context.getRoot(); }
protected Object getValueBody(OgnlContext context, Object source) throws OgnlException { return context.getRoot(); }
public Class getRootExpressionClass(Node rootNode, OgnlContext context) { if (context.getRoot() == null) return null; Class ret = context.getRoot().getClass(); if (!IRender.class.isInstance(context.getRoot()) && context.getFirstAccessor() != null && context.getFirstAccessor().isInstance(context.getRoot())) { ret = context.getFirstAccessor(); } return ret; }
public Class getRootExpressionClass(Node rootNode, OgnlContext context) { if (context.getRoot() == null) return null; Class ret = context.getRoot().getClass(); if (context.getFirstAccessor() != null && context.getFirstAccessor().isInstance(context.getRoot())) { ret = context.getFirstAccessor(); } return ret; }
public Object getProperty(OgnlContext context, Object source) throws OgnlException { return _children[0].getValue(context, context.getRoot()); }
public Class getRootExpressionClass(Node rootNode, OgnlContext context) { if (context.getRoot() == null) return null; Class ret = context.getRoot().getClass(); if (context.getFirstAccessor() != null && context.getFirstAccessor().isInstance(context.getRoot())) { ret = context.getFirstAccessor(); } return ret; }
public Object getProperty(OgnlContext context, Object source) throws OgnlException { return _children[0].getValue(context, context.getRoot()); }
public Object get(String name) { Object root = contexts.remove(name).getRoot(); removal.removeExtraElements(); if (root.getClass().isArray()) { return removal.removeNullsFromArray(root); } return root; }
public void activateObject(Object obj) throws Exception { OgnlContext context = (OgnlContext)obj; if (context.getRoot() != null || context.getValues().size() > 0) { context.clear(); } } }
public void activateObject(Object obj) throws Exception { OgnlContext context = (OgnlContext)obj; if (context.getRoot() != null || context.getValues().size() > 0) { context.clear(); context.setRoot(null); } } }
@Test @Ignore("Mocks with mockito don't work") public void settingShouldNullifyUpToIndexAndIgnoreRemoval() throws Exception { final Long[] l = new Long[] {}; when(context.getRoot()).thenReturn(instance); when(typeConverter.convertValue(anyMap(), any(), (Member) any(Member.class), anyString(), any(), any(Class.class))).thenReturn(22L); accessor.setProperty(context, l, 1, 22L); assertThat(instance.simpleNode[0], is(nullValue())); assertThat(instance.simpleNode[1], is(equalTo(22L))); }
protected void setValueBody(OgnlContext context, Object target, Object value) throws OgnlException { Object expr = _children[0].getValue(context, target), previousRoot = context.getRoot(); Node node; target = _children[1].getValue(context, target); node = (expr instanceof Node) ? (Node) expr : (Node) Ognl.parseExpression(expr.toString()); try { context.setRoot(target); node.setValue(context, target, value); } finally { context.setRoot(previousRoot); } }
protected Object getValueBody(OgnlContext context, Object source) throws OgnlException { Object result, expr = _children[0].getValue(context, source), previousRoot = context.getRoot(); Node node; source = _children[1].getValue(context, source); node = (expr instanceof Node) ? (Node) expr : (Node) Ognl.parseExpression(expr.toString()); try { context.setRoot(source); result = node.getValue(context, source); } finally { context.setRoot(previousRoot); } return result; }
protected void setValueBody( OgnlContext context, Object target, Object value ) throws OgnlException { Object expr = children[0].getValue(context, target), previousRoot = context.getRoot(); Node node; target = children[1].getValue( context, target ); node = (expr instanceof Node) ? (Node) expr : (Node) Ognl.parseExpression( expr.toString() ); try { context.setRoot( target ); node.setValue( context, target, value ); } finally { context.setRoot( previousRoot ); } }
@Before public void setup() { MockitoAnnotations.initMocks(this); this.instance = new ArrayList<String>(); when(context.getRoot()).thenReturn(instance); when(context.get("rootType")).thenReturn(Types.listOf(String.class)); when(converters.to(String.class)).thenReturn((Converter) new StringConverter()); this.accessor = new ListAccessor(converters); }
protected Object getValueBody( OgnlContext context, Object source ) throws OgnlException { Object[] args = OgnlRuntime.getObjectArrayPool().create(jjtGetNumChildren()); Object root = context.getRoot(); try { for ( int i=0, icount = args.length; i < icount; ++i ) args[i] = children[i].getValue(context, root); return OgnlRuntime.callStaticMethod( context, className, methodName, args ); } finally { OgnlRuntime.getObjectArrayPool().recycle(args); } }
protected Object getValueBody(OgnlContext context, Object source) throws OgnlException { Object[] args = OgnlRuntime.getObjectArrayPool().create(jjtGetNumChildren()); Object root = context.getRoot(); try { for(int i = 0, icount = args.length; i < icount; ++i) args[i] = _children[i].getValue(context, root); return OgnlRuntime.callStaticMethod(context, _className, _methodName, args); } finally { OgnlRuntime.getObjectArrayPool().recycle(args); } }
protected Object getValueBody(OgnlContext context, Object source) throws OgnlException { Object[] args = OgnlRuntime.getObjectArrayPool().create(jjtGetNumChildren()); Object root = context.getRoot(); try { for(int i = 0, icount = args.length; i < icount; ++i) args[i] = _children[i].getValue(context, root); return OgnlRuntime.callStaticMethod(context, _className, _methodName, args); } finally { OgnlRuntime.getObjectArrayPool().recycle(args); } }