Last active
May 2, 2020 11:56
-
-
Save poemsk/d8dca33ee471fbd93c284efadb3bb5c0 to your computer and use it in GitHub Desktop.
Building Android Library From Scratch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ExampleClient { | |
private ExampleClient(Context context, String key, int logLevel, String environment) { | |
} | |
private static Builder { | |
private Context context; | |
private String key; | |
private int logLevel; | |
private String 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(String 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