[open-ils-commits] r7751 - trunk/Open-ILS/src/java/org/open_ils/idl
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Aug 30 15:16:23 EDT 2007
Author: erickson
Date: 2007-08-30 15:10:20 -0400 (Thu, 30 Aug 2007)
New Revision: 7751
Modified:
trunk/Open-ILS/src/java/org/open_ils/idl/IDLParser.java
Log:
added some convenience methods
Modified: trunk/Open-ILS/src/java/org/open_ils/idl/IDLParser.java
===================================================================
--- trunk/Open-ILS/src/java/org/open_ils/idl/IDLParser.java 2007-08-30 12:56:54 UTC (rev 7750)
+++ trunk/Open-ILS/src/java/org/open_ils/idl/IDLParser.java 2007-08-30 19:10:20 UTC (rev 7751)
@@ -33,9 +33,12 @@
/** If true, we retain the full set of IDL objects in memory. This is true by default. */
private boolean keepIDLObjects;
+ private int parsedObjectCount;
+
public IDLParser() {
IDLObjects = new HashMap<String, IDLObject>();
keepIDLObjects = true;
+ parsedObjectCount = 0;
}
public IDLParser(String fileName) throws IOException {
@@ -47,6 +50,7 @@
this.inStream = inStream;
}
+
/**
* Parses the IDL XML
*/
@@ -89,13 +93,29 @@
}
}
- /**
+ /**
* Returns the IDLObject with the given IDLClass
*/
- public IDLObject getObject(String IDLClass) {
+ public IDLObject getObject(String IDLClass) {
return (IDLObject) IDLObjects.get(IDLClass);
- }
+ }
+ /**
+ * Returns the full set of IDL objects as a hash from classname to object.
+ * If keepIDLObjects is false, the map will be empty.
+ */
+ public HashMap<String, IDLObject> getIDLObjects() {
+ return IDLObjects;
+ }
+
+ /**
+ * Returns the number of parsed objects, regardless of the keepIDLObjects setting.
+ */
+ public int getObjectCount() {
+ return parsedObjectCount;
+ }
+
+
public void handleStartElement(XMLStreamReader reader) {
if(!OILS_NS_BASE.equals(reader.getNamespaceURI())) return;
@@ -157,6 +177,8 @@
OSRFRegistry.registerObject(
current.getIDLClass(), OSRFRegistry.WireProtocol.ARRAY, fieldNames);
+ parsedObjectCount++;
+
current = null;
}
}
More information about the open-ils-commits
mailing list