Advanced java code dealing with real world problems.

Thursday, September 3, 2009

Portable java mail message bean - Part 3

In Part 1 and Part 2 we defined body part bean class and message bean class. Two more classes need to be defined. One is message node class that represent a body part, another is the direct replacement of java mail message header class that implements the Serializable interface.

1) Message Node class:
package blog.javaclue.javamail;

import java.io.Serializable;
/**
* define an extended BodypartBean class to store additional data
*/
public final class MessageNode implements Serializable {
private static final long serialVersionUID = 750866110886999439L;

BodypartBean aNode = null;

int level = 0;

public MessageNode(BodypartBean aNode, int level) {
this.aNode = aNode;
this.level = level;
}

public BodypartBean getBodypartNode() {
return aNode;
}

public int getLevel() {
return level;
}
}
2) Message header class:
package blog.javaclue.javamail;

/**
* A portable Message Header.
*
* @author JackW
*/
public final class MsgHeader implements java.io.Serializable {
private static final long serialVersionUID = -5722833299002367057L;
private String name;
private String value;

public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
Stay tuned for the utility class that converts java mail message to the portable message, or vise verse.

No comments:

Post a Comment

Followers

About Me

An IT professional with more than 20 years of experience in enterprise computing. An Audio enthusiast designed and built DIY audio gears and speakers.