I am using a few Java classes like javax.Mail.Session
and MessageDigest
for a tool I am building.
I noticed that it was difficult assigning them properties because they were using String
constants for that.
For example, for a Session
object, you have to assign String
key value pairs in a Property
instance which is then used to create a Session
. So if you want your session to log debugging messages, assign "smtp.mail.debug"
, "true"
in the Property
instance. Similarly, if you want your MessageDigest
to use SHA
, create the MessageDigest
instance as MessageDigest.getInstance("SHA")
I am yet to figure out what to do and where to get the information if say I wanted to implement MessageDigest
using MD5
/ RC4
etc, or add another property to my Session
object.
Wouldn't it be really better if public enums were exposed by these respective classes to assign properties ?
Would save programmers lot of searching time at least.