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

📄 listuibean.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:   ListUIBean.java

package org.apache.struts2.components;

import com.opensymphony.xwork2.util.ValueStack;
import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.util.ContainUtil;
import org.apache.struts2.util.MakeIterator;

// Referenced classes of package org.apache.struts2.components:
//			UIBean

public abstract class ListUIBean extends UIBean
{

	protected Object list;
	protected String listKey;
	protected String listValue;
	protected boolean throwExceptionOnNullValueAttribute;

	protected ListUIBean(ValueStack stack, HttpServletRequest request, HttpServletResponse response)
	{
		super(stack, request, response);
		throwExceptionOnNullValueAttribute = false;
	}

	public void evaluateExtraParams()
	{
		Object value = null;
		if (list == null)
			list = parameters.get("list");
		if (list instanceof String)
			value = findValue((String)list);
		else
		if (list instanceof Collection)
			value = list;
		else
		if (MakeIterator.isIterable(list))
			value = MakeIterator.convert(list);
		if (value == null)
			if (throwExceptionOnNullValueAttribute)
				value = findValue(list != null ? list.toString() : (String)list, "list", (new StringBuilder()).append("The requested list key '").append(list).append("' could not be resolved as a collection/array/map/enumeration/iterator type. ").append("Example: people or people.{name}").toString());
			else
				value = findValue(list != null ? list.toString() : (String)list);
		if (value instanceof Collection)
			addParameter("list", value);
		else
			addParameter("list", MakeIterator.convert(value));
		if (value instanceof Collection)
			addParameter("listSize", new Integer(((Collection)value).size()));
		else
		if (value instanceof Map)
			addParameter("listSize", new Integer(((Map)value).size()));
		else
		if (value != null && value.getClass().isArray())
			addParameter("listSize", new Integer(Array.getLength(value)));
		if (listKey != null)
			addParameter("listKey", listKey);
		else
		if (value instanceof Map)
			addParameter("listKey", "key");
		if (listValue != null)
		{
			if (altSyntax() && listValue.startsWith("%{") && listValue.endsWith("}"))
				listValue = listValue.substring(2, listValue.length() - 1);
			addParameter("listValue", listValue);
		} else
		if (value instanceof Map)
			addParameter("listValue", "value");
	}

	public boolean contains(Object obj1, Object obj2)
	{
		return ContainUtil.contains(obj1, obj2);
	}

	protected Class getValueClassType()
	{
		return null;
	}

	public void setList(Object list)
	{
		this.list = list;
	}

	public void setListKey(String listKey)
	{
		this.listKey = listKey;
	}

	public void setListValue(String listValue)
	{
		this.listValue = listValue;
	}

	public void setThrowExceptionOnNullValueAttribute(boolean throwExceptionOnNullValueAttribute)
	{
		this.throwExceptionOnNullValueAttribute = throwExceptionOnNullValueAttribute;
	}
}

⌨️ 快捷键说明

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