本文整理匯總了Java中com.opensymphony.xwork2.util.Key類的典型用法代碼示例。如果您正苦於以下問題:Java Key類的具體用法?Java Key怎麽用?Java Key使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Key類屬於com.opensymphony.xwork2.util包,在下文中一共展示了Key類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getKeyClass
import com.opensymphony.xwork2.util.Key; //導入依賴的package包/類
/**
* Determines the key class by looking for the value of @Key annotation for the given class.
* If no annotation is found, the key class is determined by using the generic parametrics.
*
* As fallback, it determines the key class by looking for the value of Key_${property} in the properties
* file for the given class.
*
* @param parentClass the Class which contains as a property the Map or Collection we are finding the key for.
* @param property the property of the Map or Collection for the given parent class
* @see com.opensymphony.xwork2.conversion.ObjectTypeDeterminer#getKeyClass(Class, String)
*/
public Class getKeyClass(Class parentClass, String property) {
Key annotation = getAnnotation(parentClass, property, Key.class);
if (annotation != null) {
return annotation.value();
}
Class clazz = getClass(parentClass, property, false);
if (clazz != null) {
return clazz;
}
return (Class) xworkConverter.getConverter(parentClass, KEY_PREFIX + property);
}