本文整理汇总了Java中org.simpleframework.xml.Attribute类的典型用法代码示例。如果您正苦于以下问题:Java Attribute类的具体用法?Java Attribute怎么用?Java Attribute使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Attribute类属于org.simpleframework.xml包,在下文中一共展示了Attribute类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Pod
import org.simpleframework.xml.Attribute; //导入依赖的package包/类
public Pod(@Attribute(name = "error") final boolean error,
@Attribute(name = "primary") final boolean primary,
@Attribute(name = "title") final String title,
@Attribute(name = "scanner") final String scanner,
@Attribute(name = "id") final String id,
@Attribute(name = "position") final long position,
@Attribute(name = "numsubpods") final long numsubpods,
@ElementList(inline = true, name = "subpods") final List<SubPod> subpods,
@Element(name = "states") final States states,
@Element(name = "infos") final Infos infos,
@Element(name = "definitions", required = false) final Definitions definitions) {
this.error = error;
this.title = title;
this.scanner = scanner;
this.id = id;
this.position = position;
this.numsubpods = numsubpods;
this.subpods = subpods;
this.primary = primary;
this.states = states;
this.infos = infos;
this.definitions = definitions;
}
示例2: testMixedAnnotationsWithNoDefaults
import org.simpleframework.xml.Attribute; //导入依赖的package包/类
public void testMixedAnnotationsWithNoDefaults() throws Exception {
Map<String, Contact> map = getContacts(MixedAnnotations.class);
assertEquals(map.size(), 4);
assertFalse(map.get("name").isReadOnly());
assertFalse(map.get("value").isReadOnly());
assertEquals(int.class, map.get("value").getType());
assertEquals(String.class, map.get("name").getType());
assertEquals(Attribute.class, map.get("name").getAnnotation().annotationType());
assertEquals(Element.class, map.get("value").getAnnotation().annotationType());
assertEquals(Attribute.class, map.get("name").getAnnotation(Attribute.class).annotationType());
assertEquals(Element.class, map.get("value").getAnnotation(Element.class).annotationType());
assertNull(map.get("name").getAnnotation(Root.class));
assertNull(map.get("value").getAnnotation(Root.class));
}
示例3: getInstance
import org.simpleframework.xml.Attribute; //导入依赖的package包/类
/**
* This is used to create an annotation for the provided type.
* Annotations created are used to match the type provided. So
* an array of objects will have an <code>ElementArray</code>
* annotation for example. Matching the annotation to the
* type ensures the best serialization for that type.
*
* @param type the type to create the annotation for
*
* @return this returns the synthetic annotation to be used
*/
private Annotation getInstance(Class type) throws Exception {
ClassLoader loader = getClassLoader();
Class entry = type.getComponentType();
if(type.isArray()) {
if(isPrimitive(entry)) {
return getInstance(loader, Element.class);
}
return getInstance(loader, ElementArray.class);
}
if(isPrimitive(type) && isAttribute()) {
return getInstance(loader, Attribute.class);
}
return getInstance(loader, Element.class);
}
示例4: Wahlzettel
import org.simpleframework.xml.Attribute; //导入依赖的package包/类
/**
* Konstruktor nur f�r das Laden der XML Dateien. Da m�ssen alle Angaben
* gemacht werden, die in der XML gespeichert sind.
*
* @param id
* @param valid
* @param stimmen
* @param commited
*/
public Wahlzettel(@Attribute(name = "id") int id,
@Attribute(name = "valid") boolean valid,
@ElementList(name = "stimmen") ArrayList<Stimme> stimmen,
@Attribute(name = "commited") int commited,
@Attribute(name = "party") int party) {
this.id = id;
this.rc = new RegelChecker();
this.stimmen = stimmen;
this.valid = valid;
this.commited = commited;
this.party=party;
//sortieren:
Collections.sort(stimmen);
}
示例5: Alternative
import org.simpleframework.xml.Attribute; //导入依赖的package包/类
public Alternative(@Attribute(name = "level", required = false) final String level,
@Attribute(name = "score", required = false) final double score,
@Text final String text) {
this.level = level;
this.score = score;
this.text = text;
}
示例6: StateList
import org.simpleframework.xml.Attribute; //导入依赖的package包/类
public StateList(@Attribute(name = "count") final long count,
@Attribute(name = "delimiters", required = false) final String delimiters,
@ElementList(inline = true, name = "state") final List<State> state,
@Attribute(name = "value", required = false) final String value) {
this.count = count;
this.delimiters = delimiters;
this.state = state;
this.value = value;
}
示例7: States
import org.simpleframework.xml.Attribute; //导入依赖的package包/类
public States(@Attribute(name = "count") final long count,
@ElementList(inline = true, name = "state") final List<State> state,
@Element(name = "statelist", required = false) final StateList stateList) {
this.count = count;
this.state = state;
this.stateList = stateList;
}
示例8: Assumption
import org.simpleframework.xml.Attribute; //导入依赖的package包/类
public Assumption(@Attribute(name = "count") final long count,
@Attribute(name = "template", required = false) final String template,
@Attribute(name = "type") final String type,
@ElementList(inline = true, name = "value") final List<Value> values,
@Attribute(name = "word", required = false) final String word,
@Attribute(name = "current", required = false) final long current,
@Attribute(name = "desc", required = false) final String desc) {
this.count = count;
this.template = template;
this.type = type;
this.values = values;
this.word = word;
this.current = current;
this.desc = desc;
}
示例9: SubPod
import org.simpleframework.xml.Attribute; //导入依赖的package包/类
public SubPod(@Element(name = "plaintext") final String plaintext,
@Attribute(name = "title") final String title,
@Element(name = "imagesource", required = false) final String imagesource) {
this.plaintext = plaintext;
this.title = title;
this.imagesource = imagesource;
}
示例10: SpellCheck
import org.simpleframework.xml.Attribute; //导入依赖的package包/类
public SpellCheck(@Attribute(name = "suggestion") final String suggestion,
@Attribute(name = "text") final String text,
@Attribute(name = "word") final String word) {
this.suggestion = suggestion;
this.text = text;
this.word = word;
}
示例11: Warnings
import org.simpleframework.xml.Attribute; //导入依赖的package包/类
public Warnings(@Attribute(name = "count") final long count,
@Element(name = "reinterpret", required = false) final Reinterpret reinterpret,
@Element(name = "spellcheck", required = false) final SpellCheck spellcheck) {
this.count = count;
this.reinterpret = reinterpret;
this.spellcheck = spellcheck;
}
示例12: Reinterpret
import org.simpleframework.xml.Attribute; //导入依赖的package包/类
public Reinterpret(@Attribute(name = "level", required = false) final String level,
@Attribute(name = "new", required = false) final String replaced,
@Attribute(name = "score", required = false) final double score,
@Attribute(name = "text", required = false) final String text,
@ElementList(inline = true, name = "alternative", required = false)
final List<Alternative> alternatives) {
this.level = level;
this.replaced = replaced;
this.score = score;
this.text = text;
this.alternatives = alternatives;
}
示例13: OObject
import org.simpleframework.xml.Attribute; //导入依赖的package包/类
public OObject(@Attribute(required = true, name = "O_id") String O_id,
@Element(required = true, name = "C") Type C,
IDomain parent) {
super();
this.O_id = O_id;
this.C = C;
// parent is the parent domain of this
this.parent = parent;
// NOTE: would be hackish to do the following:
// parentDomain.addObject(this);
}
示例14: ODFEdge
import org.simpleframework.xml.Attribute; //导入依赖的package包/类
public ODFEdge(@Element(required = true, name = "osrc") OObject osrc,
@Element(required = true, name = "odst") OObject odst,
@Element(required = true, name = "flow") OObject flow,
@Attribute(required = true, name = "flag") EdgeFlag flag) {
super(osrc, odst);
this.flow = flow;
this.flag = flag;
}
示例15: RenameDomain
import org.simpleframework.xml.Attribute; //导入依赖的package包/类
/**
* Use this constructor when loading from file
* @param srcObject
* @param dstDomain
*/
public RenameDomain(@Attribute(name = "srcObject") String srcObject,
@Attribute(name = "oldDomainName") String oldDomainName,
@Attribute(name = "newDomainName") String newDomainName) {
super();
this.srcObject = srcObject;
this.oldDomainName = oldDomainName;
this.newDomainName = newDomainName;
}