Skip to content

Instantly share code, notes, and snippets.

@poemswe
Last active May 2, 2020 11:56
Show Gist options
  • Select an option

  • Save poemswe/89ec03629a64097ebbc9a2ca2d9e1e9f to your computer and use it in GitHub Desktop.

Select an option

Save poemswe/89ec03629a64097ebbc9a2ca2d9e1e9f to your computer and use it in GitHub Desktop.
public class ExampleClient {
public static enum Environment {
DEV, STAGING, PROD
}
private ExampleClient(Context context, String key, int logLevel, Environment environment) {
}
private static Builder {
private Context context;
private String key;
private int logLevel;
private Environment environment
public Builder(Context context, String key) {
this.context = context;
this.key = key;
}
public Builder setLogLevel(int logLevel) {
this.logLevel = logLevel;
return this;
}
public Builder setEnvironment(Environment environment) {
this.environment = environment;
return this;
}
public ExampleClient build() {
return new ExampleClient(this.context, this.key, this.logLevel, this.environment)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment