⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 objectproxypropertyaccessor.java

📁 在Struts2中的jar包xwork的源代码.版本为2.0.7
💻 JAVA
字号:
/* * Copyright (c) 2002-2006 by OpenSymphony * All rights reserved. */package com.opensymphony.xwork2.util;import ognl.OgnlException;import ognl.OgnlRuntime;import ognl.PropertyAccessor;import java.util.Map;/** * Is able to access (set/get) properties on a given object. * <p/> * Uses Ognl internal. * * @author Gabe */public class ObjectProxyPropertyAccessor implements PropertyAccessor {    public Object getProperty(Map context, Object target, Object name) throws OgnlException {        ObjectProxy proxy = (ObjectProxy) target;        setupContext(context, proxy);        return OgnlRuntime.getPropertyAccessor(proxy.getValue().getClass()).getProperty(context, target, name);    }    public void setProperty(Map context, Object target, Object name, Object value) throws OgnlException {        ObjectProxy proxy = (ObjectProxy) target;        setupContext(context, proxy);        OgnlRuntime.getPropertyAccessor(proxy.getValue().getClass()).setProperty(context, target, name, value);    }    /**     * Sets up the context with the last property and last class     * accessed.     *     * @param context     * @param proxy     */    private void setupContext(Map context, ObjectProxy proxy) {        OgnlContextState.setLastBeanClassAccessed(context, proxy.getLastClassAccessed());        OgnlContextState.setLastBeanPropertyAccessed(context, proxy.getLastPropertyAccessed());    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -