Class MailetUtil

  extended by org.apache.mailet.base.MailetUtil

public class MailetUtil
extends Object

Collects utility methods.

Constructor Summary
Method Summary
static boolean getInitParameter(MailetConfig config, String name, boolean defaultValue)
          Gets a boolean valued init parameter.
static String normalizeSubject(String subj, String prefix)
          This takes the subject string and reduces (normailzes) it.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public MailetUtil()
Method Detail


public static String normalizeSubject(String subj,
                                      String prefix)

This takes the subject string and reduces (normailzes) it. Multiple "Re:" entries are reduced to one, and capitalized. The prefix is always moved/placed at the beginning of the line, and extra blanks are reduced, so that the output is always of the form:

<prefix> + <one-optional-"Re:"*gt; + <remaining subject>

I have done extensive testing of this routine with a standalone driver, and am leaving the commented out debug messages so that when someone decides to enhance this method, it can be yanked it from this file, embedded it with a test driver, and the comments enabled.


public static boolean getInitParameter(MailetConfig config,
                                       String name,
                                       boolean defaultValue)

Gets a boolean valued init parameter.

config - not null
name - name of the init parameter to be queried
defaultValue - this value will be substituted when the named value cannot be parse or when the init parameter is absent
true when the init parameter is true (ignoring case); false when the init parameter is false (ignoring case); otherwise the default value

Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.