&& root != null) || (root != null && ASTRootVarRef.class.isInstance(expression))) { Class castClass = OgnlRuntime.getCompiler().getRootExpressionClass(expression, context);
context.setCurrentAccessor(OgnlRuntime.getCompiler().getSuperOrInterfaceClass(m, m.getDeclaringClass()));
public String getSourceAccessor(OgnlContext context, Object target, Object name) { ListenerMap map = (ListenerMap) target; String listenerName = ((String)name).replaceAll("\"", ""); if (map.canProvideListener(listenerName)) { Class type = OgnlRuntime.getCompiler().getInterfaceClass(map.getListener(listenerName).getClass()); ExpressionCompiler.addCastString(context, "((" + type.getName() + ")"); context.setCurrentAccessor(ListenerMap.class); context.setCurrentType(type); return ".getListener(" + name + "))"; } return super.getSourceAccessor(context, target, name); }
public String toSetSourceString(OgnlContext context, Object target) { String result = ""; result += _children[0].toSetSourceString(context, target); if (ASTProperty.class.isInstance(_children[1])) { result += "((" + OgnlRuntime.getCompiler().getClassName(target.getClass()) + ")$2)."; } String value =_children[1].toSetSourceString(context, target); if (value == null) throw new UnsupportedCompilationException("Value for assignment is null, can't enhance statement to bytecode."); if (ASTSequence.class.isAssignableFrom(_children[1].getClass())) { ASTSequence seq = (ASTSequence)_children[1]; result = seq.getCoreExpression() + result; value = seq.getLastExpression(); } if (NodeType.class.isInstance(_children[1]) && !ASTProperty.class.isInstance(_children[1]) && ((NodeType)_children[1]).getGetterClass() != null) { value = "new " + ((NodeType)_children[1]).getGetterClass().getName() + "(" + value + ")"; } return result + value + ")"; }
second += "((" + OgnlRuntime.getCompiler().getClassName(target.getClass()) + ")$2)."; core = core.substring(0, core.lastIndexOf(";")); second = OgnlRuntime.getCompiler().createLocalReference(context, "ognl.OgnlOps.returnValue(($w)" + core + ", ($w) " + seq.getLastExpression() + ")", Object.class); result = OgnlRuntime.getCompiler().createLocalReference(context, "ognl.OgnlOps.returnValue(($w)" + result + ", ($w)" + ((OrderedReturn)_children[0]).getLastExpression() + ")", Object.class);
public String getSourceAccessor(OgnlContext context, Object target, Object name) { IBeanProvider provider = (IBeanProvider)target; String beanName = ((String)name).replaceAll("\"", ""); if (provider.canProvideBean(beanName)) { Class type = OgnlRuntime.getCompiler().getInterfaceClass(provider.getBean(beanName).getClass()); ExpressionCompiler.addCastString(context, "((" + type.getName() + ")"); context.setCurrentAccessor(IBeanProvider.class); context.setCurrentType(type); return ".getBean(" + name + "))"; } return super.getSourceAccessor(context, target, name); }
public String getSourceAccessor(OgnlContext context, Object target, Object name) { IBeanProvider provider = (IBeanProvider)target; String beanName = ((String)name).replaceAll("\"", ""); if (provider.canProvideBean(beanName)) { Class type = OgnlRuntime.getCompiler().getInterfaceClass(provider.getBean(beanName).getClass()); ExpressionCompiler.addCastString(context, "((" + type.getName() + ")"); context.setCurrentAccessor(IBeanProvider.class); context.setCurrentType(type); return ".getBean(" + name + "))"; } return super.getSourceAccessor(context, target, name); }
public String getSourceAccessor(OgnlContext context, Object target, Object name) { ListenerMap map = (ListenerMap) target; String listenerName = ((String)name).replaceAll("\"", ""); if (map.canProvideListener(listenerName)) { Class type = OgnlRuntime.getCompiler().getInterfaceClass(map.getListener(listenerName).getClass()); ExpressionCompiler.addCastString(context, "((" + type.getName() + ")"); context.setCurrentAccessor(ListenerMap.class); context.setCurrentType(type); return ".getListener(" + name + "))"; } return super.getSourceAccessor(context, target, name); }
public String toSetSourceString(OgnlContext context, Object target) { String result = ""; result += _children[0].toSetSourceString(context, target); if (ASTProperty.class.isInstance(_children[1])) { result += "((" + OgnlRuntime.getCompiler().getClassName(target.getClass()) + ")$2)."; } String value =_children[1].toSetSourceString(context, target); if (value == null) throw new UnsupportedCompilationException("Value for assignment is null, can't enhance statement to bytecode."); if (ASTSequence.class.isAssignableFrom(_children[1].getClass())) { ASTSequence seq = (ASTSequence)_children[1]; result = seq.getCoreExpression() + result; value = seq.getLastExpression(); } if (NodeType.class.isInstance(_children[1]) && !ASTProperty.class.isInstance(_children[1]) && ((NodeType)_children[1]).getGetterClass() != null) { value = "new " + ((NodeType)_children[1]).getGetterClass().getName() + "(" + value + ")"; } return result + value + ")"; }
second += "((" + OgnlRuntime.getCompiler().getClassName(target.getClass()) + ")$2)."; core = core.substring(0, core.lastIndexOf(";")); second = OgnlRuntime.getCompiler().createLocalReference(context, "ognl.OgnlOps.returnValue(($w)" + core + ", ($w) " + seq.getLastExpression() + ")", Object.class); result = OgnlRuntime.getCompiler().createLocalReference(context, "ognl.OgnlOps.returnValue(($w)" + result + ", ($w)" + ((OrderedReturn)_children[0]).getLastExpression() + ")", Object.class);
String post = ""; if (context.getCurrentType() != null) { pre = "((" + OgnlRuntime.getCompiler().getInterfaceClass(context.getCurrentType()).getName() + ")"; post = ")";
String post = ""; if (context.getCurrentType() != null) { pre = "((" + OgnlRuntime.getCompiler().getInterfaceClass(context.getCurrentType()).getName() + ")"; post = ")";
first = OgnlRuntime.getCompiler().createLocalReference(context, first, context.getCurrentType()); second = OgnlRuntime.getCompiler().createLocalReference(context, second, context.getCurrentType());
first = OgnlRuntime.getCompiler().createLocalReference(context, first, context.getCurrentType()); second = OgnlRuntime.getCompiler().createLocalReference(context, second, context.getCurrentType());
/** * Returns true if this property is described by an IndexedPropertyDescriptor and that if * followed by an index specifier it will call the index get/set methods rather than go through * property accessors. */ public int getIndexedPropertyType(OgnlContext context, Object source) throws OgnlException { Class type = context.getCurrentType(); Class prevType = context.getPreviousType(); try { if (!isIndexedAccess()) { Object property = getProperty(context, source); if (property instanceof String) { return OgnlRuntime.getIndexedPropertyType(context, (source == null) ? null : OgnlRuntime.getCompiler().getInterfaceClass(source.getClass()), (String) property); } } return OgnlRuntime.INDEXED_PROPERTY_NONE; } finally { context.setCurrentObject(source); context.setCurrentType(type); context.setPreviousType(prevType); } }
first = OgnlRuntime.getCompiler().createLocalReference(context, first, context.getCurrentType()); second = OgnlRuntime.getCompiler().createLocalReference(context, second, context.getCurrentType());
/** * Returns true if this property is described by an IndexedPropertyDescriptor and that if * followed by an index specifier it will call the index get/set methods rather than go through * property accessors. */ public int getIndexedPropertyType(OgnlContext context, Object source) throws OgnlException { Class type = context.getCurrentType(); Class prevType = context.getPreviousType(); try { if (!isIndexedAccess()) { Object property = getProperty(context, source); if (property instanceof String) { return OgnlRuntime.getIndexedPropertyType(context, (source == null) ? null : OgnlRuntime.getCompiler().getInterfaceClass(source.getClass()), (String) property); } } return OgnlRuntime.INDEXED_PROPERTY_NONE; } finally { context.setCurrentObject(source); context.setCurrentType(type); context.setPreviousType(prevType); } }
first = OgnlRuntime.getCompiler().createLocalReference(context, first, context.getCurrentType()); second = OgnlRuntime.getCompiler().createLocalReference(context, second, context.getCurrentType());
+ pre + _children[0].toGetSourceString(context, target); if (!OgnlRuntime.isBoolean(first)) first = OgnlRuntime.getCompiler().createLocalReference(context, first, Object.class); + pre + _children[1].toSetSourceString(context, target); if (!OgnlRuntime.isBoolean(second)) second = OgnlRuntime.getCompiler().createLocalReference(context, second, context.getCurrentType());
+ pre + _children[0].toGetSourceString(context, target); if (!OgnlRuntime.isBoolean(first)) first = OgnlRuntime.getCompiler().createLocalReference(context, first, Object.class); + pre + _children[1].toSetSourceString(context, target); if (!OgnlRuntime.isBoolean(second)) second = OgnlRuntime.getCompiler().createLocalReference(context, second, context.getCurrentType());