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 GenericObjBPool extends DocumentPool implements Iterable<GenericObjB>
|
||||
{
|
||||
private static final int TYPE = 201;
|
||||
|
||||
@Override
|
||||
protected int type()
|
||||
{
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public GenericObjBPool(Client client)
|
||||
{
|
||||
super(client);
|
||||
}
|
||||
|
||||
public GenericObjBPool(Client client, int filter)
|
||||
{
|
||||
super(client, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GenericObjB factory(Node node)
|
||||
{
|
||||
return new GenericObjB(node, client);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<GenericObjB> iterator()
|
||||
{
|
||||
AbstractList<GenericObjB> ab = new AbstractList<GenericObjB>()
|
||||
{
|
||||
public int size()
|
||||
{
|
||||
return getLength();
|
||||
}
|
||||
|
||||
public GenericObjB get(int index)
|
||||
{
|
||||
return (GenericObjB) item(index);
|
||||
}
|
||||
};
|
||||
|
||||
return ab.iterator();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user