You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2011/02/28 21:29:00 UTC
svn commit: r1075520 - in /commons/sandbox/digester3/trunk/src/examples:
catalog/src/main/java/org/apache/commons/digester3/examples/catalog/Main.java
document-markup/src/main/java/org/apache/commons/digester3/examples/documentmarkup/MarkupDigester.java
Author: simonetripodi
Date: Mon Feb 28 20:29:00 2011
New Revision: 1075520
URL: http://svn.apache.org/viewvc?rev=1075520&view=rev
Log:
samples now use the auto result cast
Modified:
commons/sandbox/digester3/trunk/src/examples/catalog/src/main/java/org/apache/commons/digester3/examples/catalog/Main.java
commons/sandbox/digester3/trunk/src/examples/document-markup/src/main/java/org/apache/commons/digester3/examples/documentmarkup/MarkupDigester.java
Modified: commons/sandbox/digester3/trunk/src/examples/catalog/src/main/java/org/apache/commons/digester3/examples/catalog/Main.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/examples/catalog/src/main/java/org/apache/commons/digester3/examples/catalog/Main.java?rev=1075520&r1=1075519&r2=1075520&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/examples/catalog/src/main/java/org/apache/commons/digester3/examples/catalog/Main.java (original)
+++ commons/sandbox/digester3/trunk/src/examples/catalog/src/main/java/org/apache/commons/digester3/examples/catalog/Main.java Mon Feb 28 20:29:00 2011
@@ -66,9 +66,10 @@ public class Main {
Digester d = newLoader(new CatalogModel()).newDigester();
// Process the input file.
+ Catalog catalog = null;
try {
Reader reader = getInputData(filename);
- d.parse(reader);
+ catalog = d.parse(reader);
} catch (IOException ioe) {
System.out.println("Error reading input file:" + ioe.getMessage());
System.exit(-1);
@@ -77,11 +78,6 @@ public class Main {
System.exit(-1);
}
- // Get the first object created by the digester's rules
- // (the "root" object). Note that this is exactly the same object
- // returned by the Digester.parse method; either approach works.
- Catalog catalog = (Catalog) d.getRoot();
-
// Print out all the contents of the catalog, as loaded from
// the input file.
catalog.print();
Modified: commons/sandbox/digester3/trunk/src/examples/document-markup/src/main/java/org/apache/commons/digester3/examples/documentmarkup/MarkupDigester.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/examples/document-markup/src/main/java/org/apache/commons/digester3/examples/documentmarkup/MarkupDigester.java?rev=1075520&r1=1075519&r2=1075520&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/examples/document-markup/src/main/java/org/apache/commons/digester3/examples/documentmarkup/MarkupDigester.java (original)
+++ commons/sandbox/digester3/trunk/src/examples/document-markup/src/main/java/org/apache/commons/digester3/examples/documentmarkup/MarkupDigester.java Mon Feb 28 20:29:00 2011
@@ -159,28 +159,28 @@ public class MarkupDigester implements D
return this.wrapped.getMatch();
}
- public Object parse(File file) throws IOException, SAXException {
- return this.wrapped.parse(file);
+ public <T> T parse(File file) throws IOException, SAXException {
+ return this.wrapped.<T>parse(file);
}
- public Object parse(InputSource input) throws IOException, SAXException {
- return this.wrapped.parse(input);
+ public <T> T parse(InputSource input) throws IOException, SAXException {
+ return this.wrapped.<T>parse(input);
}
- public Object parse(InputStream input) throws IOException, SAXException {
- return this.wrapped.parse(input);
+ public <T> T parse(InputStream input) throws IOException, SAXException {
+ return this.wrapped.<T>parse(input);
}
- public Object parse(Reader reader) throws IOException, SAXException {
- return this.wrapped.parse(reader);
+ public <T> T parse(Reader reader) throws IOException, SAXException {
+ return this.wrapped.<T>parse(reader);
}
- public Object parse(String uri) throws IOException, SAXException {
- return this.wrapped.parse(uri);
+ public <T> T parse(String uri) throws IOException, SAXException {
+ return this.wrapped.<T>parse(uri);
}
- public Object parse(URL url) throws IOException, SAXException {
- return this.wrapped.parse(url);
+ public <T> T parse(URL url) throws IOException, SAXException {
+ return this.wrapped.<T>parse(url);
}
public Rules getRules() {