james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r894105 - /james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/
Date Sun, 27 Dec 2009 19:53:46 GMT
Author: bago
Date: Sun Dec 27 19:53:45 2009
New Revision: 894105

URL: http://svn.apache.org/viewvc?rev=894105&view=rev
Log:
Generics for FieldParser (not so useful "casting-wise", but remove some warning)

Modified:
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/AddressListField.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/ContentDispositionField.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingField.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DateTimeField.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DefaultFieldParser.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/FieldParser.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/MailboxField.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/MailboxListField.java
    james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/AddressListField.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/AddressListField.java?rev=894105&r1=894104&r2=894105&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/AddressListField.java
(original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/AddressListField.java
Sun Dec 27 19:53:45 2009
@@ -70,8 +70,8 @@
         parsed = true;
     }
 
-    static final FieldParser PARSER = new FieldParser() {
-        public ParsedField parse(final String name, final String body,
+    static final FieldParser<AddressListField> PARSER = new FieldParser<AddressListField>()
{
+        public AddressListField parse(final String name, final String body,
                 final ByteSequence raw) {
             return new AddressListField(name, body, raw);
         }

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/ContentDispositionField.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/ContentDispositionField.java?rev=894105&r1=894104&r2=894105&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/ContentDispositionField.java
(original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/ContentDispositionField.java
Sun Dec 27 19:53:45 2009
@@ -317,8 +317,8 @@
         parsed = true;
     }
 
-    static final FieldParser PARSER = new FieldParser() {
-        public ParsedField parse(final String name, final String body,
+    static final FieldParser<ContentDispositionField> PARSER = new FieldParser<ContentDispositionField>()
{
+        public ContentDispositionField parse(final String name, final String body,
                 final ByteSequence raw) {
             return new ContentDispositionField(name, body, raw);
         }

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingField.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingField.java?rev=894105&r1=894104&r2=894105&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingField.java
(original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/ContentTransferEncodingField.java
Sun Dec 27 19:53:45 2009
@@ -56,8 +56,8 @@
         return MimeUtil.ENC_7BIT;
     }
 
-    static final FieldParser PARSER = new FieldParser() {
-        public ParsedField parse(final String name, final String body,
+    static final FieldParser<ContentTransferEncodingField> PARSER = new FieldParser<ContentTransferEncodingField>()
{
+        public ContentTransferEncodingField parse(final String name, final String body,
                 final ByteSequence raw) {
             return new ContentTransferEncodingField(name, body, raw);
         }

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java?rev=894105&r1=894104&r2=894105&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java
(original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/ContentTypeField.java
Sun Dec 27 19:53:45 2009
@@ -249,8 +249,8 @@
         parsed = true;
     }
 
-    static final FieldParser PARSER = new FieldParser() {
-        public ParsedField parse(final String name, final String body,
+    static final FieldParser<ContentTypeField> PARSER = new FieldParser<ContentTypeField>()
{
+        public ContentTypeField parse(final String name, final String body,
                 final ByteSequence raw) {
             return new ContentTypeField(name, body, raw);
         }

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DateTimeField.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DateTimeField.java?rev=894105&r1=894104&r2=894105&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DateTimeField.java
(original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DateTimeField.java
Sun Dec 27 19:53:45 2009
@@ -80,8 +80,8 @@
         parsed = true;
     }
 
-    static final FieldParser PARSER = new FieldParser() {
-        public ParsedField parse(final String name, final String body,
+    static final FieldParser<DateTimeField> PARSER = new FieldParser<DateTimeField>()
{
+        public DateTimeField parse(final String name, final String body,
                 final ByteSequence raw) {
             return new DateTimeField(name, body, raw);
         }

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DefaultFieldParser.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DefaultFieldParser.java?rev=894105&r1=894104&r2=894105&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DefaultFieldParser.java
(original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DefaultFieldParser.java
Sun Dec 27 19:53:45 2009
@@ -113,19 +113,19 @@
         setFieldParser(FieldName.CONTENT_DISPOSITION,
                 ContentDispositionField.PARSER);
 
-        final FieldParser dateTimeParser = DateTimeField.PARSER;
+        final FieldParser<DateTimeField> dateTimeParser = DateTimeField.PARSER;
         setFieldParser(FieldName.DATE, dateTimeParser);
         setFieldParser(FieldName.RESENT_DATE, dateTimeParser);
 
-        final FieldParser mailboxListParser = MailboxListField.PARSER;
+        final FieldParser<MailboxListField> mailboxListParser = MailboxListField.PARSER;
         setFieldParser(FieldName.FROM, mailboxListParser);
         setFieldParser(FieldName.RESENT_FROM, mailboxListParser);
 
-        final FieldParser mailboxParser = MailboxField.PARSER;
+        final FieldParser<MailboxField> mailboxParser = MailboxField.PARSER;
         setFieldParser(FieldName.SENDER, mailboxParser);
         setFieldParser(FieldName.RESENT_SENDER, mailboxParser);
 
-        final FieldParser addressListParser = AddressListField.PARSER;
+        final FieldParser<AddressListField> addressListParser = AddressListField.PARSER;
         setFieldParser(FieldName.TO, addressListParser);
         setFieldParser(FieldName.RESENT_TO, addressListParser);
         setFieldParser(FieldName.CC, addressListParser);

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java?rev=894105&r1=894104&r2=894105&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java
(original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/DelegatingFieldParser.java
Sun Dec 27 19:53:45 2009
@@ -24,22 +24,22 @@
 
 import org.apache.james.mime4j.util.ByteSequence;
 
-public class DelegatingFieldParser implements FieldParser {
-    private static final FieldParser DEFAULT_PARSER = UnstructuredField.PARSER;
+public class DelegatingFieldParser implements FieldParser<ParsedField> {
+    private static final FieldParser<UnstructuredField> DEFAULT_PARSER = UnstructuredField.PARSER;
 
-    private Map<String, FieldParser> parsers = new HashMap<String, FieldParser>();
+    private Map<String, FieldParser<? extends ParsedField>> parsers = new HashMap<String,
FieldParser<? extends ParsedField>>();
 
     /**
      * Sets the parser used for the field named <code>name</code>.
      * @param name the name of the field
      * @param parser the parser for fields named <code>name</code>
      */
-    public void setFieldParser(final String name, final FieldParser parser) {
+    public void setFieldParser(final String name, final FieldParser<? extends ParsedField>
parser) {
         parsers.put(name.toLowerCase(), parser);
     }
     
-    public FieldParser getParser(final String name) {
-        final FieldParser field = parsers.get(name.toLowerCase());
+    public FieldParser<? extends ParsedField> getParser(final String name) {
+        final FieldParser<? extends ParsedField> field = parsers.get(name.toLowerCase());
         if (field == null) {
             return DEFAULT_PARSER;
         }
@@ -47,7 +47,7 @@
     }
     
     public ParsedField parse(final String name, final String body, final ByteSequence raw)
{
-        final FieldParser parser = getParser(name);
+        final FieldParser<? extends ParsedField> parser = getParser(name);
         return parser.parse(name, body, raw);
     }
 }

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/FieldParser.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/FieldParser.java?rev=894105&r1=894104&r2=894105&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/FieldParser.java (original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/FieldParser.java Sun
Dec 27 19:53:45 2009
@@ -21,8 +21,8 @@
 
 import org.apache.james.mime4j.util.ByteSequence;
 
-public interface FieldParser {
+public interface FieldParser<T extends ParsedField> {
     
-    ParsedField parse(final String name, final String body, final ByteSequence raw);
+    T parse(final String name, final String body, final ByteSequence raw);
     
 }

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/MailboxField.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/MailboxField.java?rev=894105&r1=894104&r2=894105&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/MailboxField.java
(original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/MailboxField.java
Sun Dec 27 19:53:45 2009
@@ -75,8 +75,8 @@
         parsed = true;
     }
 
-    static final FieldParser PARSER = new FieldParser() {
-        public ParsedField parse(final String name, final String body,
+    static final FieldParser<MailboxField> PARSER = new FieldParser<MailboxField>()
{
+        public MailboxField parse(final String name, final String body,
                 final ByteSequence raw) {
             return new MailboxField(name, body, raw);
         }

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/MailboxListField.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/MailboxListField.java?rev=894105&r1=894104&r2=894105&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/MailboxListField.java
(original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/MailboxListField.java
Sun Dec 27 19:53:45 2009
@@ -71,8 +71,8 @@
         parsed = true;
     }
 
-    static final FieldParser PARSER = new FieldParser() {
-        public ParsedField parse(final String name, final String body,
+    static final FieldParser<MailboxListField> PARSER = new FieldParser<MailboxListField>()
{
+        public MailboxListField parse(final String name, final String body,
                 final ByteSequence raw) {
             return new MailboxListField(name, body, raw);
         }

Modified: james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java
URL: http://svn.apache.org/viewvc/james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java?rev=894105&r1=894104&r2=894105&view=diff
==============================================================================
--- james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java
(original)
+++ james/mime4j/trunk/core/src/main/java/org/apache/james/mime4j/field/UnstructuredField.java
Sun Dec 27 19:53:45 2009
@@ -49,8 +49,8 @@
         parsed = true;
     }
 
-    static final FieldParser PARSER = new FieldParser() {
-        public ParsedField parse(final String name, final String body,
+    static final FieldParser<UnstructuredField> PARSER = new FieldParser<UnstructuredField>()
{
+        public UnstructuredField parse(final String name, final String body,
                 final ByteSequence raw) {
             return new UnstructuredField(name, body, raw);
         }



Mime
View raw message