org.simpleframework.xml.ElementList Java Examples

The following examples show how to use org.simpleframework.xml.ElementList. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PackageParserTest.java    From simplexml with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #2
Source File: UnionComplicatedPathMixTest.java    From simplexml with Apache License 2.0 6 votes vote down vote up
public ComplicatedExample(
      @Path("x:path[1]") @ElementMap(name="a") Map<Key, Entry> map,
      @Path("x:path[2]") @ElementList(name="a") List<Entry> list,
      @Element(name="elementOne") String elementOne,
      @Element(name="elementTwo") String elementTwo,
      @Element(name="elementThree") String elementThree,
      @Text String text,
      @Path("x:path[2]/x:someOtherPath") @Attribute(name="attribute_one") String attribute_one,
      @Path("x:path[2]/x:someOtherPath") @Attribute(name="attribute_two") String attribute_two) 
{
   this.map = map;
   this.list = list;
   this.elementOne = elementOne;
   this.elementTwo = elementTwo;
   this.elementThree = elementThree;
   this.text = text;
   this.attribute_one = attribute_one;
   this.attribute_two = attribute_two;
}
 
Example #3
Source File: FieldScannerDefaultTest.java    From simplexml with Apache License 2.0 6 votes vote down vote up
public void testMixedAnnotations() throws Exception {
   Map<String, Contact> map = getContacts(MixedAnnotations.class);
   
   assertEquals(map.size(), 3);
   assertFalse(map.get("name").isReadOnly());
   assertFalse(map.get("value").isReadOnly());
   assertFalse(map.get("list").isReadOnly());
   
   assertEquals(String.class, map.get("name").getType());
   assertEquals(int.class, map.get("value").getType());
   assertEquals(List.class, map.get("list").getType());
   
   assertEquals(Element.class, map.get("name").getAnnotation().annotationType());
   assertEquals(Attribute.class, map.get("value").getAnnotation().annotationType());
   assertEquals(ElementList.class, map.get("list").getAnnotation().annotationType());
   
   assertEquals(Element.class, map.get("name").getAnnotation(Element.class).annotationType());
   assertEquals(Attribute.class, map.get("value").getAnnotation(Attribute.class).annotationType());
   assertEquals(ElementList.class, map.get("list").getAnnotation(ElementList.class).annotationType());
   
   assertNull(map.get("name").getAnnotation(Root.class));
   assertNull(map.get("value").getAnnotation(Root.class));
   assertNull(map.get("list").getAnnotation(Root.class));
}
 
Example #4
Source File: Pod.java    From Saiy-PS with GNU Affero General Public License v3.0 6 votes vote down vote up
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;
}
 
Example #5
Source File: FieldScanner.java    From simplexml with Apache License 2.0 5 votes vote down vote up
/**
 * This reflectively checks the annotation to determine the type 
 * of annotation it represents. If it represents an XML schema
 * annotation it is used to create a <code>Contact</code> which 
 * can be used to represent the field within the source object.
 * 
 * @param field the field that the annotation comes from
 * @param label the annotation used to model the XML schema
 * @param list this is the list of annotations on the field
 */
private void scan(Field field, Annotation label, Annotation[] list) {
   if(label instanceof Attribute) {
      process(field, label, list);
   }
   if(label instanceof ElementUnion) {
      process(field, label, list);
   }
   if(label instanceof ElementListUnion) {
      process(field, label, list);
   }
   if(label instanceof ElementMapUnion) {
      process(field, label, list);
   }
   if(label instanceof ElementList) {
      process(field, label, list);
   }     
   if(label instanceof ElementArray) {
      process(field, label, list);
   }
   if(label instanceof ElementMap) {
      process(field, label, list);
   }
   if(label instanceof Element) {
      process(field, label, list);
   }       
   if(label instanceof Version) {
      process(field, label, list);
   }
   if(label instanceof Text) {
      process(field, label, list);
   }
   if(label instanceof Transient) {
      remove(field, label);
   }
}
 
Example #6
Source File: LabelFactoryTest.java    From simplexml with Apache License 2.0 5 votes vote down vote up
public void testUnionList() throws Exception {
   FieldScanner scanner = new FieldScanner(new DetailScanner(ExampleList.class), new Support());
   Support support = new Support();
   Contact contact = scanner.get(0);
   ElementList element = ((ElementListUnion)contact.getAnnotation()).value()[0];
   Label unionLabel = support.getLabel(contact, contact.getAnnotation());
   Label elementLabel = support.getLabel(contact, element);
   
   assertEquals(unionLabel.getName(), "a");
   assertEquals(elementLabel.getName(), "a");
}
 
Example #7
Source File: StructureBuilder.java    From simplexml with Apache License 2.0 5 votes vote down vote up
/**
 * This reflectively checks the annotation to determine the type 
 * of annotation it represents. If it represents an XML schema
 * annotation it is used to create a <code>Label</code> which can
 * be used to represent the field within the context object.
 * 
 * @param field the field that the annotation comes from
 * @param label the annotation used to model the XML schema
 * 
 * @throws Exception if there is more than one text annotation
 */   
public void process(Contact field, Annotation label) throws Exception {
   if(label instanceof Attribute) {
      process(field, label, attributes);
   }
   if(label instanceof ElementUnion) {
      union(field, label, elements);
   }
   if(label instanceof ElementListUnion) {
      union(field, label, elements);
   }
   if(label instanceof ElementMapUnion) {
      union(field, label, elements);
   }
   if(label instanceof ElementList) {
      process(field, label, elements);
   }
   if(label instanceof ElementArray) {
      process(field, label, elements);
   }
   if(label instanceof ElementMap) {
      process(field, label, elements);
   }
   if(label instanceof Element) {
      process(field, label, elements);
   }    
   if(label instanceof Version) {
      version(field, label);
   }
   if(label instanceof Text) {
      text(field, label);
   }
}
 
Example #8
Source File: LabelExtractor.java    From simplexml with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an entry that is used to select the constructor for the
 * label. Each label must implement a constructor that takes a
 * contact and the specific XML annotation for that field. If the
 * annotation is not know this method throws an exception.
 * 
 * @param label the XML annotation used to create the label
 * 
 * @return this returns the entry used to create a constructor
 */
private LabelBuilder getBuilder(Annotation label) throws Exception{   
   if(label instanceof Element) {
      return new LabelBuilder(ElementLabel.class, Element.class);
   }
   if(label instanceof ElementList) {
      return new LabelBuilder(ElementListLabel.class, ElementList.class);
   }
   if(label instanceof ElementArray) {
      return new LabelBuilder(ElementArrayLabel.class, ElementArray.class);               
   }
   if(label instanceof ElementMap) {
      return new LabelBuilder(ElementMapLabel.class, ElementMap.class);
   }
   if(label instanceof ElementUnion) {
      return new LabelBuilder(ElementUnionLabel.class, ElementUnion.class, Element.class);
   }
   if(label instanceof ElementListUnion) {
      return new LabelBuilder(ElementListUnionLabel.class, ElementListUnion.class, ElementList.class);
   }
   if(label instanceof ElementMapUnion) {
      return new LabelBuilder(ElementMapUnionLabel.class, ElementMapUnion.class, ElementMap.class);
   }
   if(label instanceof Attribute) {
      return new LabelBuilder(AttributeLabel.class, Attribute.class);
   }
   if(label instanceof Version) {
      return new LabelBuilder(VersionLabel.class, Version.class);
   }
   if(label instanceof Text) {
      return new LabelBuilder(TextLabel.class, Text.class);
   }
   throw new PersistenceException("Annotation %s not supported", label);
}
 
Example #9
Source File: Reinterpret.java    From Saiy-PS with GNU Affero General Public License v3.0 5 votes vote down vote up
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;
}
 
Example #10
Source File: ElementListParameter.java    From simplexml with Apache License 2.0 5 votes vote down vote up
/**   
 * Constructor for the <code>ElementListParameter</code> object.
 * This is used to create a parameter that can be used to 
 * determine a consistent name using the provided XML annotation.
 * 
 * @param factory this is the constructor the parameter is in
 * @param value this is the annotation used for the parameter
 * @param format this is the format used to style this parameter
 * @param index this is the index the parameter appears at
 */
public ElementListParameter(Constructor factory, ElementList value, Format format, int index) throws Exception {
   this.contact = new Contact(value, factory, index);
   this.label = new ElementListLabel(contact, value, format);
   this.expression = label.getExpression();
   this.path = label.getPath();
   this.type = label.getType();
   this.name = label.getName();
   this.key = label.getKey();
   this.index = index;
}
 
Example #11
Source File: AnnotationHandlerTest.java    From simplexml with Apache License 2.0 5 votes vote down vote up
@ElementArray
@ElementList
@ElementMap
@Element
public void testHandler() throws Exception {
   AnnotationHandler elementHandler = new AnnotationHandler(Element.class);
   Element element = getClass().getDeclaredMethod("testHandler").getAnnotation(Element.class);
   
   System.err.println(elementHandler);
   System.err.println(element);
   
   AnnotationHandler elementListHandler = new AnnotationHandler(ElementList.class);
   ElementList elementList = getClass().getDeclaredMethod("testHandler").getAnnotation(ElementList.class);
   
   System.err.println(elementListHandler);
   System.err.println(elementList);
   
   AnnotationHandler elementMapHandler = new AnnotationHandler(ElementMap.class);
   ElementMap elementMap = getClass().getDeclaredMethod("testHandler").getAnnotation(ElementMap.class);
   
   System.err.println(elementMapHandler);
   System.err.println(elementMap);
   
   AnnotationHandler elementArrayHandler = new AnnotationHandler(ElementArray.class);
   ElementArray elementArray = getClass().getDeclaredMethod("testHandler").getAnnotation(ElementArray.class);
   
   System.err.println(elementArrayHandler);
   System.err.println(elementArray);
}
 
Example #12
Source File: ElementListLabel.java    From simplexml with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor for the <code>ElementListLabel</code> object. This
 * creates a label object, which can be used to convert an XML 
 * node to a <code>Collection</code> of XML serializable objects.
 * 
 * @param contact this is the contact that this label represents
 * @param label the annotation that contains the schema details
 * @param format this is used to style the elements in the list
 */
public ElementListLabel(Contact contact, ElementList label, Format format) {
   this.detail = new Introspector(contact, this, format);
   this.decorator = new Qualifier(contact);
   this.required = label.required();
   this.type = contact.getType();
   this.override = label.name();  
   this.inline = label.inline();
   this.entry = label.entry();
   this.data = label.data();
   this.item = label.type();
   this.format = format;
   this.label = label;
}
 
Example #13
Source File: SignatureScanner.java    From simplexml with Apache License 2.0 5 votes vote down vote up
/**
 * This is used to create <code>Parameter</code> objects which are
 * used to represent the parameters in a constructor. Each parameter
 * contains an annotation an the index it appears in.
 * 
 * @param label this is the annotation used for the parameter
 * @param ordinal this is the position the parameter appears at
 * 
 * @return this returns the parameters for the constructor
 */
private List<Parameter> process(Annotation label, int ordinal) throws Exception{
   if(label instanceof Attribute) {
      return create(label, ordinal);
   }
   if(label instanceof Element) {
      return create(label, ordinal);
   }
   if(label instanceof ElementList) {
      return create(label, ordinal);
   }     
   if(label instanceof ElementArray) {
      return create(label, ordinal);
   }
   if(label instanceof ElementMap) {
      return create(label, ordinal);
   }
   if(label instanceof ElementListUnion) {
      return union(label, ordinal);
   }     
   if(label instanceof ElementMapUnion) {
      return union(label, ordinal);
   }
   if(label instanceof ElementUnion) {
      return union(label, ordinal);
   }
   if(label instanceof Text) {
      return create(label, ordinal);
   }
   return emptyList();
}
 
Example #14
Source File: MethodScanner.java    From simplexml with Apache License 2.0 5 votes vote down vote up
/**
 * This reflectively checks the annotation to determine the type 
 * of annotation it represents. If it represents an XML schema
 * annotation it is used to create a <code>Contact</code> which 
 * can be used to represent the method within the source object.
 * 
 * @param method the method that the annotation comes from
 * @param label the annotation used to model the XML schema
 * @param list this is the list of annotations on the method
 */ 
private void scan(Method method, Annotation label, Annotation[] list) throws Exception {
   if(label instanceof Attribute) {
      process(method, label, list);
   }
   if(label instanceof ElementUnion) {
      process(method, label, list);
   }
   if(label instanceof ElementListUnion) {
      process(method, label, list);
   }
   if(label instanceof ElementMapUnion) {
      process(method, label, list);
   }
   if(label instanceof ElementList) {
      process(method, label, list);
   }
   if(label instanceof ElementArray) {
      process(method, label, list);
   }
   if(label instanceof ElementMap) {
      process(method, label, list);
   }
   if(label instanceof Element) {
      process(method, label, list);
   }    
   if(label instanceof Version) {
      process(method, label, list);
   }
   if(label instanceof Text) {
      process(method, label, list);
   }
   if(label instanceof Transient) {
      remove(method, label, list);
   }
}
 
Example #15
Source File: Assumption.java    From Saiy-PS with GNU Affero General Public License v3.0 5 votes vote down vote up
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;
}
 
Example #16
Source File: StateList.java    From Saiy-PS with GNU Affero General Public License v3.0 5 votes vote down vote up
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;
}
 
Example #17
Source File: States.java    From Saiy-PS with GNU Affero General Public License v3.0 5 votes vote down vote up
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;
}
 
Example #18
Source File: UnionElementListInConstructorTest.java    From simplexml with Apache License 2.0 5 votes vote down vote up
public InlineListUnion(
      @Path("x:path[1]") @ElementList(name="a") List<Entry> one,
      @Path("y:path[2]") @ElementList(name="a") List<Entry> two)
{
   this.one = one;
   this.two = two;
}
 
Example #19
Source File: Test3Test.java    From simplexml with Apache License 2.0 5 votes vote down vote up
public Test3(  @Path(value="elements")
            @ElementListUnion({
               @ElementList(entry="element-a", type=MyElementA.class, inline=true),
               @ElementList(entry="element-b", type=MyElementB.class, inline=true)
            })
            final java.util.ArrayList<MyElement> elements
      ) {
   super();
   this.elements = elements;
}
 
Example #20
Source File: Test4Test.java    From simplexml with Apache License 2.0 5 votes vote down vote up
@Path(value="elements")
@ElementListUnion({
   @ElementList(entry="elementA", type=MyElementA.class, inline=true),
   @ElementList(entry="elementB", type=MyElementB.class, inline=true),
   @ElementList(entry="element", type=MyElement.class, inline=true)
})
java.util.ArrayList<MyElement> getElements(){
   return this.elements;
}
 
Example #21
Source File: Test4Test.java    From simplexml with Apache License 2.0 5 votes vote down vote up
@Path(value="elements")
@ElementListUnion({
   @ElementList(entry="elementA", type=MyElementA.class, inline=true),
   @ElementList(entry="elementB", type=MyElementB.class, inline=true),
   @ElementList(entry="element", type=MyElement.class, inline=true)
})
void setElements(final java.util.ArrayList<MyElement> elements){
   this.elements = elements;
}
 
Example #22
Source File: Test5Test.java    From simplexml with Apache License 2.0 5 votes vote down vote up
@Path(value="elements")
@ElementListUnion({
   @ElementList(entry="elementA", type=MyElementA.class, inline=true),
   @ElementList(entry="elementB", type=MyElementB.class, inline=true),
   @ElementList(entry="element", type=MyElement.class, inline=true)
})
java.util.ArrayList<MyElement> getElements(){
   return this.elements;
}
 
Example #23
Source File: Test5Test.java    From simplexml with Apache License 2.0 5 votes vote down vote up
@Path(value="elements")
@ElementListUnion({
   @ElementList(entry="elementA", type=MyElementA.class, inline=true),
   @ElementList(entry="elementB", type=MyElementB.class, inline=true),
   @ElementList(entry="element", type=MyElement.class, inline=true)
})
void setElements(final java.util.ArrayList<MyElement> elements){
   this.elements = elements;
}
 
Example #24
Source File: Test2_ReplaceTest.java    From simplexml with Apache License 2.0 5 votes vote down vote up
protected Test2(@Element(name="type") final String type
      , @Element(name="element") final Test2 element
      , @ElementList(name="elements") final ArrayList<Test2> elements) {
   super();
   this.type = type;
   this.element = element;
   this.elements = elements;
}
 
Example #25
Source File: MethodPartFactoryTest.java    From simplexml with Apache License 2.0 5 votes vote down vote up
public void testMethodPart() throws Exception {
   assertTrue(Element.class.isAssignableFrom(new MethodPartFactory(new DetailScanner(MethodPartFactoryTest.class), new Support()).getInstance(Bean.class.getMethod("getInteger"), new Annotation[0]).getAnnotation().getClass()));
   assertTrue(Element.class.isAssignableFrom(new MethodPartFactory(new DetailScanner(MethodPartFactoryTest.class), new Support()).getInstance(Bean.class.getMethod("setInteger", int.class), new Annotation[0]).getAnnotation().getClass()));
   assertTrue(ElementMap.class.isAssignableFrom(new MethodPartFactory(new DetailScanner(MethodPartFactoryTest.class), new Support()).getInstance(Bean.class.getMethod("getMap"), new Annotation[0]).getAnnotation().getClass()));
   assertTrue(ElementMap.class.isAssignableFrom(new MethodPartFactory(new DetailScanner(MethodPartFactoryTest.class), new Support()).getInstance(Bean.class.getMethod("setMap", Map.class), new Annotation[0]).getAnnotation().getClass()));
   assertTrue(ElementList.class.isAssignableFrom(new MethodPartFactory(new DetailScanner(MethodPartFactoryTest.class), new Support()).getInstance(Bean.class.getMethod("getList"), new Annotation[0]).getAnnotation().getClass()));
   assertTrue(ElementList.class.isAssignableFrom(new MethodPartFactory(new DetailScanner(MethodPartFactoryTest.class), new Support()).getInstance(Bean.class.getMethod("setList", List.class), new Annotation[0]).getAnnotation().getClass()));
   assertTrue(ElementArray.class.isAssignableFrom(new MethodPartFactory(new DetailScanner(MethodPartFactoryTest.class), new Support()).getInstance(Bean.class.getMethod("getArray"), new Annotation[0]).getAnnotation().getClass()));
   assertTrue(ElementArray.class.isAssignableFrom(new MethodPartFactory(new DetailScanner(MethodPartFactoryTest.class), new Support()).getInstance(Bean.class.getMethod("setArray", String[].class), new Annotation[0]).getAnnotation().getClass()));
}
 
Example #26
Source File: AnnotationProviderTest.java    From simplexml with Apache License 2.0 5 votes vote down vote up
public void testProvider() throws Exception {
   assertTrue(ElementMap.class.isAssignableFrom(new AnnotationFactory(new DetailScanner(AnnotationProviderTest.class), new Support()).getInstance(Map.class, null).getClass()));
   assertTrue(ElementMap.class.isAssignableFrom(new AnnotationFactory(new DetailScanner(AnnotationProviderTest.class), new Support()).getInstance(HashMap.class, null).getClass()));
   assertTrue(ElementMap.class.isAssignableFrom(new AnnotationFactory(new DetailScanner(AnnotationProviderTest.class), new Support()).getInstance(ConcurrentHashMap.class, null).getClass()));
   assertTrue(ElementMap.class.isAssignableFrom(new AnnotationFactory(new DetailScanner(AnnotationProviderTest.class), new Support()).getInstance(LinkedHashMap.class, null).getClass()));
   assertTrue(ElementMap.class.isAssignableFrom(new AnnotationFactory(new DetailScanner(AnnotationProviderTest.class), new Support()).getInstance(Map.class, null).getClass()));
   assertTrue(ElementList.class.isAssignableFrom(new AnnotationFactory(new DetailScanner(AnnotationProviderTest.class), new Support()).getInstance(Set.class, null).getClass()));
   assertTrue(ElementList.class.isAssignableFrom(new AnnotationFactory(new DetailScanner(AnnotationProviderTest.class), new Support()).getInstance(Collection.class, null).getClass()));
   assertTrue(ElementList.class.isAssignableFrom(new AnnotationFactory(new DetailScanner(AnnotationProviderTest.class), new Support()).getInstance(List.class, null).getClass()));
   assertTrue(ElementList.class.isAssignableFrom(new AnnotationFactory(new DetailScanner(AnnotationProviderTest.class), new Support()).getInstance(TreeSet.class, null).getClass()));
   assertTrue(ElementList.class.isAssignableFrom(new AnnotationFactory(new DetailScanner(AnnotationProviderTest.class), new Support()).getInstance(HashSet.class, null).getClass()));
   assertTrue(ElementList.class.isAssignableFrom(new AnnotationFactory(new DetailScanner(AnnotationProviderTest.class), new Support()).getInstance(ArrayList.class, null).getClass()));
}
 
Example #27
Source File: Test3_2Test.java    From simplexml with Apache License 2.0 5 votes vote down vote up
@Path(value="elements")
@ElementListUnion({
   @ElementList(entry="element-a", type=MyElementA.class, inline=true),
   @ElementList(entry="element-b", type=MyElementB.class, inline=true)
})
public java.util.ArrayList<MyElement> getElements(){
   return new java.util.ArrayList<MyElement>(this.elements);
}
 
Example #28
Source File: Test3_2Test.java    From simplexml with Apache License 2.0 5 votes vote down vote up
public Test3_2(   @Path(value="elements")
            @ElementListUnion({
               @ElementList(entry="element-a", type=MyElementA.class, inline=true),
               @ElementList(entry="element-b", type=MyElementB.class, inline=true)
            })
            final java.util.ArrayList<MyElement> elements
      ) {
   super();
   this.elements = elements;
}
 
Example #29
Source File: Test3_2Test.java    From simplexml with Apache License 2.0 5 votes vote down vote up
public Test3_3(   @Path(value="elements")
            @ElementListUnion({
               @ElementList(entry="element-a", type=MyElementA.class, inline=true),
               @ElementList(entry="element-b", type=MyElementB.class, inline=true)
            })
            final java.util.Collection<MyElement> elements
      ) {
   super();
   this.elements = elements;
}
 
Example #30
Source File: Test2Test.java    From simplexml with Apache License 2.0 5 votes vote down vote up
public Test2(  @ElementListUnion({
               @ElementList(name="elements", entry="element-a", type=MyElementA.class),
               @ElementList(name="elements", entry="element-b", type=MyElementB.class)
            })
            final java.util.ArrayList<MyElement> elements
      ) {
   super();
   this.elements = elements;
}