Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1.   public static FirstStep builder() {
  2.         PrinterConfiguration configuration = new PrinterConfiguration();
  3.         return (ip) -> {
  4.             configuration.ip = ip;
  5.             return (port) -> {
  6.                 configuration.port = port;
  7.                 return (dpi) -> {
  8.                     configuration.dpi = dpi;
  9.                     return () -> configuration;
  10.                 };
  11.             };
  12.         };
  13.     }
  14.  
  15.     @FunctionalInterface
  16.     public interface FirstStep {
  17.         SecondStep withIp(String ip);
  18.     }
  19.  
  20.     @FunctionalInterface
  21.     public interface SecondStep {
  22.         ThirdStep withPort(int port);
  23.     }
  24.  
  25.     @FunctionalInterface
  26.     public interface ThirdStep {
  27.         LastStep withDpi(double dpi);
  28.     }
  29.  
  30.     @FunctionalInterface
  31.     public interface LastStep {
  32.         PrinterConfiguration build();
  33.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement