本文整理汇总了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);
}