-
Notifications
You must be signed in to change notification settings - Fork 21
/
Entities.java
53 lines (45 loc) · 1.22 KB
/
Entities.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package org.alm.model;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElementRefs;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "Entities")
@XmlAccessorType(XmlAccessType.FIELD)
public class Entities<T extends Entity>
{
@XmlElementRefs({
@XmlElementRef(name="Entity", type=TestInstance.class),
@XmlElementRef(name="Entity", type=RunStep.class)})
private List<T> entities;
public Entities()
{
this(new ArrayList<T>());
}
public Entities(Collection<T> entities)
{
if (entities instanceof List)
{
this.entities = (List<T>) entities;
}
else
{
this.entities = new ArrayList<T>(entities);
}
}
public List<T> entities()
{
return entities;
}
public void entities(List<T> entities)
{
this.entities = entities;
}
public void addEntity(T entity)
{
entities.add(entity);
}
}