本文整理汇总了Java中org.simpleframework.xml.stream.Style.getAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java Style.getAttribute方法的具体用法?Java Style.getAttribute怎么用?Java Style.getAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.simpleframework.xml.stream.Style
的用法示例。
在下文中一共展示了Style.getAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assembleAttributes
import org.simpleframework.xml.stream.Style; //导入方法依赖的package包/类
/**
* This is used to assemble the model by perform registrations
* based on the <code>Order</code> annotation. The initial
* registrations performed by this establish the element and
* attribute order for serialization of the schema class.
*
* @param model the model to perform registrations on
* @param order this is the order specified by the class
*/
private void assembleAttributes(Model model, Order order) throws Exception {
for(String value : order.attributes()) {
Expression path = builder.build(value);
if(!path.isAttribute() && path.isPath()) {
throw new PathException("Ordered attribute '%s' references an element in %s", path, detail);
}
if(!path.isPath()) {
Style style = format.getStyle();
String name = style.getAttribute(value);
model.registerAttribute(name);
} else {
registerAttributes(model, path);
}
}
}
示例2: getName
import org.simpleframework.xml.stream.Style; //导入方法依赖的package包/类
/**
* This is used to acquire the name of the element or attribute
* that is used by the class schema. The name is determined by
* checking for an override within the annotation. If it contains
* a name then that is used, if however the annotation does not
* specify a name the the field or method name is used instead.
*
* @return returns the name that is used for the XML property
*/
public String getName() throws Exception {
Style style = format.getStyle();
String name = detail.getName();
return style.getAttribute(name);
}