|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.mail.EmailUtils
Utility methods used by commons-email.
These methods are copied from other commons components (commons-lang) to avoid creating a dependency for such a small component.
This is a package scoped class, and should not be used directly by users.
Field Summary | |
private static java.util.Random |
RANDOM
Random object used by random method. |
Constructor Summary | |
private |
EmailUtils()
Constructs a new EmailException with no detail message. |
Method Summary | |
(package private) static boolean |
isEmpty(java.lang.String str)
Checks if a String is empty ("") or null. |
(package private) static boolean |
isNotEmpty(java.lang.String str)
Checks if a String is not empty ("") and not null. |
(package private) static void |
notNull(java.lang.Object object,
java.lang.String message)
Validate an argument, throwing IllegalArgumentException if the argument is null . |
private static java.lang.String |
random(int count,
int start,
int end,
boolean letters,
boolean numbers,
char[] chars,
java.util.Random random)
Creates a random string based on a variety of options, using supplied source of randomness. |
(package private) static java.lang.String |
randomAlphabetic(int count)
Creates a random string whose length is the number of characters specified. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.util.Random RANDOM
Random object used by random method. This has to be not local to the random method so as to not return the same value in the same millisecond.
Constructor Detail |
private EmailUtils()
EmailException
with no detail message.
Method Detail |
static boolean isEmpty(java.lang.String str)
Checks if a String is empty ("") or null.
str
- the String to check, may be null
true
if the String is empty or nullstatic boolean isNotEmpty(java.lang.String str)
Checks if a String is not empty ("") and not null.
str
- the String to check, may be null
true
if the String is not empty and not nullstatic void notNull(java.lang.Object object, java.lang.String message)
Validate an argument, throwing IllegalArgumentException
if the argument is null
.
object
- the object to check is not null
message
- the exception message you would like to see if the object is null
java.lang.IllegalArgumentException
- if the object is null
static java.lang.String randomAlphabetic(int count)
Creates a random string whose length is the number of characters specified.
Characters will be chosen from the set of alphabetic characters.
count
- the length of random string to create
private static java.lang.String random(int count, int start, int end, boolean letters, boolean numbers, char[] chars, java.util.Random random)
Creates a random string based on a variety of options, using supplied source of randomness.
If start and end are both 0
, start and end are set to ' '
and 'z'
, the ASCII
printable characters, will be used, unless letters and numbers are both false
, in which case, start and end
are set to 0
and Integer.MAX_VALUE
.
If set is not null
, characters between start and end are chosen.
This method accepts a user-supplied Random
instance to use as a source of randomness. By seeding a single Random
instance with a fixed seed and using it for each call, the same random sequence of strings can be generated
repeatedly and predictably.
count
- the length of random string to createstart
- the position in set of chars to start atend
- the position in set of chars to end beforeletters
- only allow letters?numbers
- only allow numbers?chars
- the set of chars to choose randoms from. If null
, then it will use the set of all chars.random
- a source of randomness.
java.lang.IllegalArgumentException
- if count
< 0.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |