本文整理匯總了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;
}