-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFluentMailer.java
More file actions
27 lines (23 loc) · 842 Bytes
/
FluentMailer.java
File metadata and controls
27 lines (23 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.util.function.Consumer;
/**
* Created by darwinmorales on 28/11/2015.
*/
public class FluentMailer {
private FluentMailer() {}
public FluentMailer from (final String address) {return this;}
public FluentMailer to (final String address) {return this;}
public FluentMailer subject (final String line) {return this;}
public FluentMailer body (final String message) {return this;}
public static void send(final Consumer<FluentMailer> block) {
final FluentMailer mailer = new FluentMailer();
block.accept(mailer);
System.out.println("sending....");
}
public static void main(String[] args) {
FluentMailer.send(mailer ->
mailer.from("")
.to("")
.subject("")
.body(""));
}
}