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

📄 attributemap.java

📁 struts 2 核心包 的源码 有错误是难免的
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   AttributeMap.java

package org.apache.struts2.util;

import java.util.*;
import javax.servlet.jsp.PageContext;

public class AttributeMap
	implements Map
{

	protected static final String UNSUPPORTED = "method makes no sense for a simplified map";
	Map context;

	public AttributeMap(Map context)
	{
		this.context = context;
	}

	public boolean isEmpty()
	{
		throw new UnsupportedOperationException("method makes no sense for a simplified map");
	}

	public void clear()
	{
		throw new UnsupportedOperationException("method makes no sense for a simplified map");
	}

	public boolean containsKey(Object key)
	{
		return get(key) != null;
	}

	public boolean containsValue(Object value)
	{
		throw new UnsupportedOperationException("method makes no sense for a simplified map");
	}

	public Set entrySet()
	{
		return Collections.EMPTY_SET;
	}

	public Object get(Object key)
	{
		PageContext pc = getPageContext();
		if (pc == null)
		{
			Map request = (Map)context.get("request");
			Map session = (Map)context.get("session");
			Map application = (Map)context.get("application");
			if (request != null && request.get(key) != null)
				return request.get(key);
			if (session != null && session.get(key) != null)
				return session.get(key);
			NullPointerException npe;
			if (application != null && application.get(key) != null)
				return application.get(key);
			else
				return null;
		}
		return pc.findAttribute(key.toString());
		npe;
		return null;
	}

	public Set keySet()
	{
		return Collections.EMPTY_SET;
	}

	public Object put(Object key, Object value)
	{
		PageContext pc = getPageContext();
		if (pc != null)
			pc.setAttribute(key.toString(), value);
		return null;
	}

	public void putAll(Map t)
	{
		throw new UnsupportedOperationException("method makes no sense for a simplified map");
	}

	public Object remove(Object key)
	{
		throw new UnsupportedOperationException("method makes no sense for a simplified map");
	}

	public int size()
	{
		throw new UnsupportedOperationException("method makes no sense for a simplified map");
	}

	public Collection values()
	{
		return Collections.EMPTY_SET;
	}

	private PageContext getPageContext()
	{
		return (PageContext)context.get("com.opensymphony.xwork2.dispatcher.PageContext");
	}
}

⌨️ 快捷键说明

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