} else if (getObject() instanceof Part) {
Part part = (Part) getObject();
ds = new FilePartDataSource(part, getType(), getName());
} else if (getObject() instanceof InputStream) {
InputStream in = (InputStream) getObject();
ds = new InputStreamDataSource(in, getType(), getName());
} else if (getObject() instanceof byte[]) {
byte[] data = (byte[]) getObject();
ds = new InputStreamDataSource(data, getType(), getName());
} else {
// TODO: other classes?
throw new MessagingException("Not yet supported: " + getObject());
}