亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? smartconvertermanager.java

?? dwr 源文件 dwr 源文件 dwr 源文件
?? JAVA
字號:
package uk.ltd.getahead.dwr.impl;

import java.lang.reflect.*;
import java.util.*;

import org.directwebremoting.util.LocalUtil;

import uk.ltd.getahead.dwr.*;
import uk.ltd.getahead.dwr.util.*;


/**
 * SmartConverterManager extends the DefaultConverterManager
 * to allow the client to give a "hint" as to the actual
 * Java type that inbound variables should be converted to.
 * This converter manager searches objects for a special
 * property called '$javaClass' containing the name of a
 * convertable Java class.  If found, this type will be
 * used instead.
 *
 * Note that this converter manager does not change the
 * actual value of the inbound variable.  So, depending on
 * the converter implementation, you may see erroneous
 * errors reported for the '$javaClass' property.
 *
 * @author  Tim Dwelle [tim at dwelle dot net]
 *
 */
public class SmartConverterManager implements ConverterManager
{
	private static final String CANT_CONVERT_JAVA_CLASS =
	    "SmartConverterManager.CantConvertJavaClass";

	private static final String CLASS_NOT_FOUND =
	    "SmartConverterManager.ClassNotFound";

	private static final String JAVA_CLASS_PROPERTY =
	    "$javaClass";

	private static final String VALUE_PROPERTY =
	    "$value";

	private static final String WRAPPER_TOKEN =
	    SmartConverterManager.class.getName() + "$";

	private static final int WRAPPER_TOKEN_LEN =
	    WRAPPER_TOKEN.length();

    private static final Logger log =
        Logger.getLogger(SmartConverterManager.class);

	// this "has-a" relationship is way more pain than just
	// using inheritence, but hopefully this will make it
	// easier if in the future someone wants a smart
	// converter manager that wraps something other than
	// the default converter manager
	private ConverterManager inner;

	/**
	 * The default constructor creates an instance of
	 * SmartConverterManager that wraps the
	 * DefaultConverterManager implementation.
	 *
	 */
	public SmartConverterManager()
	{
		this(new DefaultConverterManager());
	}

	/**
	 * Creates an instance of SmartConverterManager that
	 * wraps around an arbitrary ConverterManager
	 * implementation to make it "smart".
	 *
	 */
	public SmartConverterManager(ConverterManager cm)
	{
		this.inner = cm;
	}

	/**
	 * Converts the inbound variable, using any provided
	 * '$javaClass' property as a "hint" of the actual Java
	 * type that inbound variable should be converted to.
	 *
	 */
	public Object convertInbound(Class paramType,
	                             InboundVariable iv,
	                             InboundContext inctx)
	    throws ConversionException
	{
		// look to see if we the inbound value
		// can even contain a $javaClass property
		String value = getValue(iv);

		if (value != null)
		{
			// see if we can find a $javaClass
			// property declared for this inbound
			// value
			Class c = getJavaClass(value, inctx);
			if (c != null)
			{
				// make sure the $javaClass returned
				// is still a suitable type for
				// conversion... and doesn't violate
				// the signature we are trying to match
				if (inner.isConvertable(c) &&
				    paramType.isAssignableFrom(c))
				{
					paramType = c;

					// we cant add our $javaClass property
					// to built-in js types (strings,
					// numbers, etc.) so we have to box
					// them into a wrapper...  so if we have
					// a wrapper, we need to get the value
					// out of it first
					if (isWrapper(value, inctx))
					{
						iv = getInboundVariable(value, VALUE_PROPERTY, inctx);
					}
				}
			}
		}

		return inner.convertInbound(paramType, iv, inctx);
	}

	/**
	 * isConvertable() does not really make sense, since any
	 * class may be a base class to a more specific,
	 * convertable class that is specified using the
	 * '$javaClass' syntax.
	 *
	 * For now, this method will simply return true, and
	 * count on things to fail later, if the type is bad.
	 *
	 */
	public boolean isConvertable(Class c)
	{
		return true;
	}

	/**
	 * Defers to the wrapped ConvererManager.
	 *
	 */
	public void addConverterType(String id, Class clazz)
	{
		inner.addConverterType(id, clazz);
	}

	/**
	 * Defers to the wrapped ConvererManager.
	 *
	 */
	public void addConverter(String match, String type, Map params)
	    throws IllegalArgumentException,
	           InstantiationException,
	           IllegalAccessException
	{
		inner.addConverter(match, type, params);
	}

	/**
	 * Defers to the wrapped ConvererManager.
	 *
	 */
	public void addConverter(String match, Converter converter)
	    throws IllegalArgumentException
	{
		inner.addConverter(match, converter);
	}

	/**
	 * Defers to the wrapped ConvererManager.
	 *
	 */
	public OutboundVariable convertOutbound(Object object,
	                                        OutboundContext converted)
	    throws ConversionException
	{
		return inner.convertOutbound(object, converted);
	}

	/**
	 * Defers to the wrapped ConvererManager.
	 *
	 */
	public void setExtraTypeInfo(Method method,
	                             int paramNo,
	                             int index,
	                             Class type)
	{
		inner.setExtraTypeInfo(method, paramNo, index, type);
	}

	/**
	 * Defers to the wrapped ConvererManager.
	 *
	 */
	public Class getExtraTypeInfo(Method method, int paramNo, int index)
	{
		return inner.getExtraTypeInfo(method, paramNo, index);
	}

	/**
	 * Defers to the wrapped ConvererManager.
	 *
	 */
	public void setConverters(Map converters)
	{
		inner.setConverters(converters);
	}

	/**
	 * Gets the inbound variable for the specified property
	 * of the provided value.
	 *
	 */
	private InboundVariable getInboundVariable(String value,
	                                           String property,
	                                           InboundContext inctx)
	{
		InboundVariable iv = null;

		StringTokenizer st = new StringTokenizer(value,
		    ConversionConstants.INBOUND_MAP_SEPARATOR);

		while (st.hasMoreTokens())
		{
			String token = st.nextToken();
			if (token.trim().length() == 0)
			{
				continue;
			}

			int colonpos = token.indexOf(
			    ConversionConstants.INBOUND_MAP_ENTRY);

			if (colonpos > -1)
			{
				String key = token.substring(0, colonpos).trim();
				String val = token.substring(colonpos + 1).trim();

				key = LocalUtil.decode(key);

				if (key.equals(property))
				{
                    String[] split = LocalUtil.splitInbound(val);
                    String type = split[LocalUtil.INBOUND_INDEX_TYPE];
                    String varVal = split[LocalUtil.INBOUND_INDEX_VALUE];

                    iv = new InboundVariable(inctx, type, varVal);
				}
			}
		}

		return iv;
	}

	/**
	 * Parse the properties for this value, looking for a
	 * '$javaClass' property.  If one exists, return the
	 * value as a Class.
	 *
	 */
	private Class getJavaClass(String value, InboundContext inctx)
	{
		Class c = null;

		InboundVariable classVar =
		   getInboundVariable(value, JAVA_CLASS_PROPERTY, inctx);

		if (classVar != null)
		{
			String className = null;

			try
			{
				Object obj = convertInbound(String.class, classVar, inctx);

				if (obj != null)
				{
					className = obj.toString();

					// the classname may be proceeded by
					// the wrapper token... if so, we want
					// to trim that part off
					if (className.indexOf(WRAPPER_TOKEN) == 0)
					{
						className = className.substring(WRAPPER_TOKEN_LEN);
					}

					c = LocalUtil.classForName(className);
				}
			}
			catch(ConversionException cex)
			{
				log.error(Messages.getString(CANT_CONVERT_JAVA_CLASS));
			}
			catch(ClassNotFoundException cnfex)
			{
				log.error(Messages.getString(CLASS_NOT_FOUND, className));
			}
        }

		return c;
	}

	/**
	 * Get the value from the inbound variable.  If the
	 * value is null, or not a map, then it can't possibly
	 * contain our '$javaClass' property... so null will be
	 * returned. Otherwise, the value will be returned, with
	 * the map's start & end trimmed off.
	 *
	 */
	private String getValue(InboundVariable iv)
	{
		String value = iv.getValue();

		if (value.trim().equals(ConversionConstants.INBOUND_NULL) ||
		    !value.startsWith(ConversionConstants.INBOUND_MAP_START) ||
		    !value.endsWith(ConversionConstants.INBOUND_MAP_END))
		{
			value = null;
		}
		else
		{
	        value = value.substring(1, value.length() - 1);
		}

		return value;
	}

	/**
	 * Checks to see whether or not the specified value is a
	 * wrapper for a non-object javascript type.
	 *
	 */
	private boolean isWrapper(String value, InboundContext inctx)
	{
		boolean wrapper = false;

		InboundVariable classVar =
		   getInboundVariable(value, JAVA_CLASS_PROPERTY, inctx);

		if (classVar != null)
		{
			try
			{
				Object obj = convertInbound(String.class, classVar, inctx);

				if (obj != null)
				{
					String className = obj.toString();

					// the classname may be proceeded by
					// the wrapper token... if so, we want
					// to trim that part off
					wrapper = (className.indexOf(WRAPPER_TOKEN) == 0);
				}
			}
			catch(ConversionException cex)
			{
				log.error(Messages.getString(CANT_CONVERT_JAVA_CLASS));
			}
        }

		return wrapper;
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91麻豆精品视频| 久久一夜天堂av一区二区三区| 欧美日韩国产区一| 久久综合色婷婷| 亚洲午夜久久久久久久久电影院 | 国产福利一区二区三区视频| 成人免费精品视频| 精品国产91洋老外米糕| 亚洲午夜久久久久久久久久久| 国产.精品.日韩.另类.中文.在线.播放| 欧美三片在线视频观看 | 一二三区精品福利视频| 国产夫妻精品视频| 精品日韩99亚洲| 亚洲第一成年网| 国产成a人亚洲精| 久久午夜老司机| 毛片av一区二区三区| 欧美日韩黄色一区二区| 亚洲美女视频在线| eeuss国产一区二区三区| 2021国产精品久久精品| 久久精品国产99久久6| 日韩视频在线一区二区| 亚洲成在线观看| 欧美日韩久久一区二区| 亚洲国产你懂的| 欧美探花视频资源| 亚洲一区在线看| 色琪琪一区二区三区亚洲区| 亚洲免费高清视频在线| 色综合久久久久久久久久久| 亚洲视频每日更新| 91麻豆成人久久精品二区三区| 国产精品少妇自拍| 99精品国产视频| 亚洲欧美另类久久久精品2019| av电影在线观看一区| 亚洲男人的天堂网| 欧洲色大大久久| 性久久久久久久久| 日韩一区二区三区精品视频| 免费高清视频精品| 久久久久久久久99精品| 成人综合在线网站| 一区二区三区在线免费观看| 欧美在线小视频| 奇米精品一区二区三区在线观看一| 69av一区二区三区| 国产中文字幕一区| 国产精品欧美综合在线| 色综合久久久久综合体桃花网| 亚洲综合色在线| 日韩美女一区二区三区| 处破女av一区二区| 亚洲国产精品久久人人爱| 欧美精品乱码久久久久久按摩| 另类专区欧美蜜桃臀第一页| 中文字幕av不卡| 欧美精品日韩精品| 国产成人一级电影| 亚洲黄色小说网站| 欧美成人官网二区| 91亚洲永久精品| 秋霞午夜av一区二区三区| 久久久www免费人成精品| 91在线视频观看| 日韩精品亚洲一区| 国产精品灌醉下药二区| 91麻豆精品国产无毒不卡在线观看| 国产酒店精品激情| 亚洲免费在线播放| 久久综合久久综合九色| 色婷婷狠狠综合| 国内精品伊人久久久久av一坑| 亚洲乱码中文字幕| 欧美成人综合网站| 在线观看欧美黄色| 国产精品66部| 日韩av成人高清| 亚洲欧美在线aaa| 777色狠狠一区二区三区| 国产suv精品一区二区6| 日韩精品一二三四| 又紧又大又爽精品一区二区| 久久综合五月天婷婷伊人| 欧美日韩一二三| av在线一区二区| 国产精选一区二区三区| 日韩中文字幕不卡| 亚洲美女视频在线观看| 亚洲国产成人一区二区三区| 日韩三级电影网址| 欧美美女黄视频| 在线视频你懂得一区| 国产.精品.日韩.另类.中文.在线.播放| 日韩 欧美一区二区三区| 一区二区三区中文字幕| 国产精品久久三| 久久亚洲综合色| 精品国产乱码久久久久久免费| 欧美日韩大陆一区二区| 色综合一个色综合| 大尺度一区二区| 国产不卡视频在线播放| 国产精品夜夜爽| 国产福利一区二区三区| 国产激情偷乱视频一区二区三区| 久久国产综合精品| 久久福利视频一区二区| 久久se精品一区精品二区| 日韩高清在线电影| 石原莉奈一区二区三区在线观看| 亚洲精品高清视频在线观看| 亚洲精品第1页| 亚洲福利视频导航| 亚洲444eee在线观看| 视频一区二区三区入口| 日本美女视频一区二区| 日本欧美韩国一区三区| 蜜臀久久99精品久久久久宅男| 五月婷婷综合激情| 日韩精品1区2区3区| 丝瓜av网站精品一区二区| 天天操天天干天天综合网| 日韩电影在线免费看| 日韩av一二三| 国产在线一区二区| 粉嫩绯色av一区二区在线观看| 成人一二三区视频| 日本电影亚洲天堂一区| 欧美最新大片在线看 | 国产成人a级片| youjizz国产精品| 一本大道综合伊人精品热热| 91国产视频在线观看| 4438成人网| 精品欧美一区二区久久 | 国产成人av一区二区| 不卡的av网站| 欧洲一区二区三区免费视频| 欧美顶级少妇做爰| 国产亚洲精久久久久久| 亚洲女性喷水在线观看一区| 亚洲观看高清完整版在线观看| 久草中文综合在线| 99国产欧美另类久久久精品| 欧美日韩国产一二三| 久久亚洲春色中文字幕久久久| 国产精品成人网| 日韩av在线播放中文字幕| 国产iv一区二区三区| 欧洲另类一二三四区| 日韩精品一区二区三区视频| 日本一区二区三区免费乱视频 | 久久久www成人免费无遮挡大片| 中文字幕一区在线观看视频| 亚洲成a人v欧美综合天堂| 国产成人亚洲综合a∨婷婷| 日本高清成人免费播放| 日韩免费一区二区| 一区二区三区中文字幕精品精品| 精品一区二区三区在线观看 | 国产成人综合在线播放| 欧美日韩一卡二卡三卡 | 国产亚洲一区二区三区在线观看| 亚洲精品五月天| 国产精品一二三区| 制服丝袜在线91| 自拍偷拍亚洲欧美日韩| 久久激情综合网| 欧美高清视频一二三区| 中文字幕亚洲精品在线观看| 日本欧美久久久久免费播放网| 色激情天天射综合网| 国产精品色在线观看| 激情小说亚洲一区| 欧美一区二区三区免费| 亚洲精品日产精品乱码不卡| 国产99久久久国产精品免费看| 欧美一区日本一区韩国一区| 亚洲精品成人a在线观看| 成人免费视频免费观看| 国产日韩亚洲欧美综合| 久久精品国产第一区二区三区| 911精品国产一区二区在线| 国产精品久久久久久久第一福利| 国产永久精品大片wwwapp| 日韩欧美国产精品一区| 午夜精品久久久久久久久久| 91免费观看国产| 日韩理论片一区二区| av亚洲产国偷v产偷v自拍| 国产片一区二区三区| 国产酒店精品激情| 国产欧美一区二区精品性色超碰| 国产呦萝稀缺另类资源| 久久久久久久综合日本| 国产一区二区三区免费播放| 久久午夜色播影院免费高清|