当前位置: 首页>>代码示例>>Java>>正文


Java Element类代码示例

本文整理汇总了Java中org.simpleframework.xml.Element的典型用法代码示例。如果您正苦于以下问题:Java Element类的具体用法?Java Element怎么用?Java Element使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Element类属于org.simpleframework.xml包,在下文中一共展示了Element类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Pod

import org.simpleframework.xml.Element; //导入依赖的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;
}
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:24,代码来源:Pod.java

示例2: testMixedAnnotationsWithNoDefaults

import org.simpleframework.xml.Element; //导入依赖的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));
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:20,代码来源:MethodScannerDefaultTest.java

示例3: getInstance

import org.simpleframework.xml.Element; //导入依赖的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);
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:27,代码来源:AnnotationFactory.java

示例4: testParser

import org.simpleframework.xml.Element; //导入依赖的package包/类
public void testParser() throws Exception {
   assertEquals("http://util.java/HashMap", parse(HashMap.class));
   assertEquals("http://simpleframework.org/xml/Element", parse(Element.class));
   assertEquals("http://simpleframework.org/xml/ElementList", parse(ElementList.class));
   assertEquals("http://w3c.org/dom/Node", parse(Node.class));
   assertEquals("http://simpleframework.org/xml/strategy/PackageParser", parse(PackageParser.class));
   
   assertEquals(HashMap.class, revert("http://util.java/HashMap"));
   assertEquals(Element.class, revert("http://simpleframework.org/xml/Element"));
   assertEquals(ElementList.class, revert("http://simpleframework.org/xml/ElementList"));
   assertEquals(Node.class, revert("http://w3c.org/dom/Node"));
   assertEquals(PackageParser.class, revert("http://simpleframework.org/xml/strategy/PackageParser"));
   
   long start = System.currentTimeMillis();
   for(int i = 0; i < ITERATIONS; i++) {
      fastParse(ElementList.class);
   }
   long fast = System.currentTimeMillis() - start;
   start = System.currentTimeMillis();
   for(int i = 0; i < ITERATIONS; i++) {
      parse(ElementList.class);
   }
   long normal = System.currentTimeMillis() - start;
   System.out.printf("fast=%sms normal=%sms diff=%s%n", fast, normal, normal / fast);
}
 
开发者ID:ngallagher,项目名称:simplexml,代码行数:26,代码来源:PackageParserTest.java

示例5: Episode

import org.simpleframework.xml.Element; //导入依赖的package包/类
public Episode(@Element(name = "title")String title, @Element(name = "link")String link, @Element(name = "description")String description, @Element(name = "publisher", required = false)String publisher, @Element(name = "content")MediaContent content, @ElementList(name = "thumbnail", inline = true, required = false)List<Thumbnail> thumbnail) {
    this.title = title;
    this.link = link;
    this.description = description;
    this.publisher = publisher;
    this.content = content;
    this.thumbnail = thumbnail;
}
 
开发者ID:wax911,项目名称:anitrend-app,代码行数:9,代码来源:Episode.java

示例6: Channel

import org.simpleframework.xml.Element; //导入依赖的package包/类
public Channel(@Element(name = "title")String title, @Path("link") @Text(required=false)String link, @Element(name = "description")String description, @Element(name = "copyright")String copyright, @ElementList(name = "episode", inline = true)List<Episode> episode) {
    this.title = title;
    this.link = link;
    this.description = description;
    this.copyright = copyright;
    this.episode = episode;
}
 
开发者ID:wax911,项目名称:anitrend-app,代码行数:8,代码来源:Channel.java

示例7: InfoCasoSimulacion

import org.simpleframework.xml.Element; //导入依赖的package包/类
public  InfoCasoSimulacion (@Element(name="identCaso")String casoId,@Element(name="identEscenario") String escenarioId){ 
 identCaso= casoId;
 identEscenario= escenarioId;
 infoRescateVictimas = new HashMap<String, InfoRescateVictima>();
 conjVictimasRescatadas= new TreeSet <InfoRescateVictima>() ;
 infoRobotVictimasSalvadas=new HashMap<String, VictimasSalvadas>();
 infoRobotVictimasAsignadas=new HashMap<String, Set<String>>();
 victimasRescatadasPorRobot = new VictimasSalvadas();
 identsVictimasRescatadas= new VictimasSalvadas();
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:11,代码来源:InfoCasoSimulacion.java

示例8: CSEBase

import org.simpleframework.xml.Element; //导入依赖的package包/类
@Element(required = false)

    /**
     * CSEBase constructor
     *
     * @param builder
     */
    private CSEBase(Builder builder) {
        super(builder);
    }
 
开发者ID:SKT-ThingPlug,项目名称:thingplug-sdk-android,代码行数:11,代码来源:CSEBase.java

示例9: States

import org.simpleframework.xml.Element; //导入依赖的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;
}
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:8,代码来源:States.java

示例10: SubPod

import org.simpleframework.xml.Element; //导入依赖的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;
}
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:8,代码来源:SubPod.java

示例11: Warnings

import org.simpleframework.xml.Element; //导入依赖的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;
}
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:8,代码来源:Warnings.java

示例12: fromConfigXML

import org.simpleframework.xml.Element; //导入依赖的package包/类
/**
 * Creates a SourceCommandTag from a DOM element. The provided element
 * MUST be a element CommandTag element.
 *
 * @param domElement The DOM element to use.
 * @return The created SourceCommandTag.
 */
public static SourceCommandTag fromConfigXML(final org.w3c.dom.Element domElement) {
    Long id = Long.valueOf(domElement.getAttribute("id"));
    String name = domElement.getAttribute("name");

    SourceCommandTag result = new SourceCommandTag(id, name);

    Node fieldNode = null;
    String fieldName = null;
    String fieldValueString = null;
    NodeList fields = domElement.getChildNodes();

    int fieldsCount = fields.getLength();

    for (int i = 0; i < fieldsCount; i++) {
        fieldNode = fields.item(i);

        if (fieldNode.getNodeType() == 1) {
            // extract name of the XML node
            fieldName = fieldNode.getNodeName();
            // extract contents of the XML node
            fieldValueString = fieldNode.getFirstChild().getNodeValue();

            if (fieldName.equals("source-timeout")) {
                result.sourceTimeout = Integer.parseInt(fieldValueString);
            }

            if (fieldName.equals("source-retries")) {
                result.sourceRetries = Integer.parseInt(fieldValueString);
            }

            if (fieldName.equals("HardwareAddress")) {
                result.hardwareAddress = HardwareAddressFactory.getInstance().fromConfigXML((org.w3c.dom.Element) fieldNode);
            }
        }
    }
    return result;
}
 
开发者ID:c2mon,项目名称:c2mon,代码行数:45,代码来源:SourceCommandTag.java

示例13: OObject

import org.simpleframework.xml.Element; //导入依赖的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);
}
 
开发者ID:aroog,项目名称:code,代码行数:14,代码来源:OObject.java

示例14: ODFEdge

import org.simpleframework.xml.Element; //导入依赖的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;
}
 
开发者ID:aroog,项目名称:code,代码行数:9,代码来源:ODFEdge.java

示例15: OCFEdge

import org.simpleframework.xml.Element; //导入依赖的package包/类
public OCFEdge(@Element(required = true, name = "osrc") OObject osrc,
		@Element(required = true, name = "odst") OObject odst,
		@Element(required = true, name = "control") String label) {
	super(osrc, odst);

	this.label = label;
}
 
开发者ID:aroog,项目名称:code,代码行数:8,代码来源:OCFEdge.java


注:本文中的org.simpleframework.xml.Element类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。