當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。