本文整理汇总了Java中org.simpleframework.xml.Root.name方法的典型用法代码示例。如果您正苦于以下问题:Java Root.name方法的具体用法?Java Root.name怎么用?Java Root.name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.simpleframework.xml.Root
的用法示例。
在下文中一共展示了Root.name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: root
import org.simpleframework.xml.Root; //导入方法依赖的package包/类
/**
* This is used to set the optional <code>Root</code> annotation for
* the class. The root can only be set once, so if a super type also
* has a root annotation define it must be ignored.
*
* @param label this is the label used to define the root
*/
private void root(Annotation label) {
if(label != null) {
Root value = (Root)label;
String real = type.getSimpleName();
String text = real;
if(value != null) {
text = value.name();
if(isEmpty(text)) {
text = Reflector.getName(real);
}
strict = value.strict();
root = value;
name = text;
}
}
}
示例2: getRoot
import org.simpleframework.xml.Root; //导入方法依赖的package包/类
/**
* This will acquire the name of the <code>Root</code> annotation
* for the specified class. This will traverse the inheritance
* hierarchy looking for the root annotation, when it is found it
* is used to acquire a name for the XML element it represents.
*
* @param real the actual type of the object being searched
* @param type this is the type to acquire the root name with
*
* @return the root name for the specified type if it exists
*/
private String getRoot(Class<?> real, Class<?> type) {
String name = type.getSimpleName();
Root root = type.getAnnotation(Root.class);
if(root != null) {
String text = root.name();
if(!isEmpty(text)) {
return text;
}
return Reflector.getName(name);
}
return null;
}