abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r541765 - in /incubator/abdera/java/trunk: core/src/main/java/org/apache/abdera/parser/ core/src/main/java/org/apache/abdera/writer/ parser/src/main/java/org/apache/abdera/parser/stax/
Date Fri, 25 May 2007 20:04:18 GMT
Author: jmsnell
Date: Fri May 25 13:04:16 2007
New Revision: 541765

URL: http://svn.apache.org/viewvc?view=rev&rev=541765
Log:
Minor usability fix to eliminate the need to explicitly cast Writer and Parser

Modified:
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/ParserFactory.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/writer/WriterFactory.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserFactory.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWriterFactory.java

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/ParserFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/ParserFactory.java?view=diff&rev=541765&r1=541764&r2=541765
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/ParserFactory.java
(original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/ParserFactory.java
Fri May 25 13:04:16 2007
@@ -28,13 +28,13 @@
    * Get the default parser.  This is equivalent to calling Abdera.getParser()
    * @return The default parser implementation
    */
-  Parser getParser();
+  <T extends Parser>T getParser();
   
   /**
    * Get the named parser
    * @param name The name of the parser instance to retrieve
    * @return The Named parser instance
    */
-  Parser getParser(String name); 
+  <T extends Parser>T getParser(String name); 
   
 }

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/writer/WriterFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/writer/WriterFactory.java?view=diff&rev=541765&r1=541764&r2=541765
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/writer/WriterFactory.java
(original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/writer/WriterFactory.java
Fri May 25 13:04:16 2007
@@ -29,19 +29,19 @@
    * abdera.getWriter();
    * @return The default writer
    */
-  Writer getWriter();
+  <T extends Writer>T getWriter();
   
   /**
    * Get the named writer.
    * @param name The name of the writer
    * @return The specified writer
    */
-  Writer getWriter(String name);
+  <T extends Writer>T getWriter(String name);
   
   /**
    * Return a writer capable of outputting the given MIME media type
    * @param mediatype A MIME media type
    * @return A matching writer
    */
-  Writer getWriterByMediaType(String mediatype);
+  <T extends Writer>T getWriterByMediaType(String mediatype);
 }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserFactory.java?view=diff&rev=541765&r1=541764&r2=541765
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserFactory.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserFactory.java
Fri May 25 13:04:16 2007
@@ -45,13 +45,15 @@
     return abdera;
   }
   
-  public Parser getParser() {
-    return getAbdera().getParser();
+  @SuppressWarnings("unchecked")
+  public <T extends Parser>T getParser() {
+    return (T)getAbdera().getParser();
   }
 
-  public Parser getParser(String name) {
-    return (name != null) ? 
-      getParsers().get(name.toLowerCase()) : getParser();
+  @SuppressWarnings("unchecked")
+  public <T extends Parser>T getParser(String name) {
+    return (T)((name != null) ? 
+      getParsers().get(name.toLowerCase()) : getParser());
   }
 
   private Map<String,NamedParser> getParsers() {

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWriterFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWriterFactory.java?view=diff&rev=541765&r1=541764&r2=541765
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWriterFactory.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWriterFactory.java
Fri May 25 13:04:16 2007
@@ -45,19 +45,22 @@
     return abdera;
   }
   
-  public Writer getWriter() {
-    return getAbdera().getWriter();
+  @SuppressWarnings("unchecked")
+  public <T extends Writer>T getWriter() {
+    return (T)getAbdera().getWriter();
   }
 
-  public Writer getWriter(String name) {
-    return (name != null) ? 
-      getWriters().get(name.toLowerCase()) : getWriter();
+  @SuppressWarnings("unchecked")
+  public <T extends Writer>T getWriter(String name) {
+    return (T)((name != null) ? 
+      getWriters().get(name.toLowerCase()) : getWriter());
   }
 
-  public Writer getWriterByMediaType(String mediatype) {
+  @SuppressWarnings("unchecked")
+  public <T extends Writer>T getWriterByMediaType(String mediatype) {
     Map<String,NamedWriter> writers = getWriters();
     for (NamedWriter writer : writers.values()) {
-      if (writer.outputsFormat(mediatype)) return writer;
+      if (writer.outputsFormat(mediatype)) return (T)writer;
     }
     return null;
   }



Mime
View raw message