mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-23 13:15:14 +09:00
Feature #1304: Add generic Document & DocumentPool classes to Java OCA
This commit is contained in:
1 parent
e196843c9b
commit
9c2e6b14da
10 files changed
+825
-14
No files matched your search
@@ -0,0 +1,53 @@
|
||||
import java.util.AbstractList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.opennebula.client.Client;
|
||||
import org.opennebula.client.document.DocumentPool;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
|
||||
public class GenericObjAPool extends DocumentPool implements Iterable<GenericObjA>
|
||||
{
|
||||
private static final int TYPE = 200;
|
||||
|
||||
@Override
|
||||
protected int type()
|
||||
{
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public GenericObjAPool(Client client)
|
||||
{
|
||||
super(client);
|
||||
}
|
||||
|
||||
public GenericObjAPool(Client client, int filter)
|
||||
{
|
||||
super(client, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GenericObjA factory(Node node)
|
||||
{
|
||||
return new GenericObjA(node, client);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<GenericObjA> iterator()
|
||||
{
|
||||
AbstractList<GenericObjA> ab = new AbstractList<GenericObjA>()
|
||||
{
|
||||
public int size()
|
||||
{
|
||||
return getLength();
|
||||
}
|
||||
|
||||
public GenericObjA get(int index)
|
||||
{
|
||||
return (GenericObjA) item(index);
|
||||
}
|
||||
};
|
||||
|
||||
return ab.iterator();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user