當前位置: 首頁>>代碼示例>>Java>>正文


Java Key類代碼示例

本文整理匯總了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);
}
 
開發者ID:txazo,項目名稱:struts2,代碼行數:23,代碼來源:DefaultObjectTypeDeterminer.java


注:本文中的com.opensymphony.xwork2.util.Key類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。