Skip to content

Commit f2c5e81

Browse files
Remove RemoteConfig prefix from classes (#483)
1 parent 01d0c98 commit f2c5e81

File tree

9 files changed

+78
-78
lines changed

9 files changed

+78
-78
lines changed

src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfig.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,28 +73,28 @@ public static synchronized FirebaseRemoteConfig getInstance(FirebaseApp app) {
7373
/**
7474
* Gets the current active version of the Remote Config template.
7575
*
76-
* @return A {@link RemoteConfigTemplate}.
76+
* @return A {@link Template}.
7777
* @throws FirebaseRemoteConfigException If an error occurs while getting the template.
7878
*/
79-
public RemoteConfigTemplate getTemplate() throws FirebaseRemoteConfigException {
79+
public Template getTemplate() throws FirebaseRemoteConfigException {
8080
return getTemplateOp().call();
8181
}
8282

8383
/**
8484
* Similar to {@link #getTemplate()} but performs the operation asynchronously.
8585
*
86-
* @return An {@code ApiFuture} that completes with a {@link RemoteConfigTemplate} when
86+
* @return An {@code ApiFuture} that completes with a {@link Template} when
8787
* the template is available.
8888
*/
89-
public ApiFuture<RemoteConfigTemplate> getTemplateAsync() {
89+
public ApiFuture<Template> getTemplateAsync() {
9090
return getTemplateOp().callAsync(app);
9191
}
9292

93-
private CallableOperation<RemoteConfigTemplate, FirebaseRemoteConfigException> getTemplateOp() {
93+
private CallableOperation<Template, FirebaseRemoteConfigException> getTemplateOp() {
9494
final FirebaseRemoteConfigClient remoteConfigClient = getRemoteConfigClient();
95-
return new CallableOperation<RemoteConfigTemplate, FirebaseRemoteConfigException>() {
95+
return new CallableOperation<Template, FirebaseRemoteConfigException>() {
9696
@Override
97-
protected RemoteConfigTemplate execute() throws FirebaseRemoteConfigException {
97+
protected Template execute() throws FirebaseRemoteConfigException {
9898
return remoteConfigClient.getTemplate();
9999
}
100100
};

src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ interface FirebaseRemoteConfigClient {
2424
/**
2525
* Gets the current active version of the Remote Config template.
2626
*
27-
* @return A {@link RemoteConfigTemplate}.
27+
* @return A {@link Template}.
2828
* @throws FirebaseRemoteConfigException If an error occurs while getting the template.
2929
*/
30-
RemoteConfigTemplate getTemplate() throws FirebaseRemoteConfigException;
30+
Template getTemplate() throws FirebaseRemoteConfigException;
3131
}

src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigClientImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ JsonFactory getJsonFactory() {
9191
}
9292

9393
@Override
94-
public RemoteConfigTemplate getTemplate() throws FirebaseRemoteConfigException {
94+
public Template getTemplate() throws FirebaseRemoteConfigException {
9595
HttpRequestInfo request = HttpRequestInfo.buildGetRequest(remoteConfigUrl)
9696
.addAllHeaders(COMMON_HEADERS);
9797
IncomingHttpResponse response = httpClient.send(request);
9898
TemplateResponse templateResponse = httpClient.parse(response, TemplateResponse.class);
99-
RemoteConfigTemplate template = new RemoteConfigTemplate(templateResponse);
99+
Template template = new Template(templateResponse);
100100
return template.setETag(getETag(response));
101101
}
102102

src/main/java/com/google/firebase/remoteconfig/RemoteConfigParameter.java renamed to src/main/java/com/google/firebase/remoteconfig/Parameter.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,46 +27,46 @@
2727
import java.util.Map;
2828

2929
/**
30-
* Represents a Remote Config parameter that can be included in a {@link RemoteConfigTemplate}.
30+
* Represents a Remote Config parameter that can be included in a {@link Template}.
3131
* At minimum, a default value or a conditional value must be present for the
3232
* parameter to have any effect.
3333
*/
34-
public final class RemoteConfigParameter {
34+
public final class Parameter {
3535

36-
private RemoteConfigParameterValue defaultValue;
36+
private ParameterValue defaultValue;
3737
private String description;
38-
private Map<String, RemoteConfigParameterValue> conditionalValues;
38+
private Map<String, ParameterValue> conditionalValues;
3939

4040
/**
41-
* Creates a new {@link RemoteConfigParameter}.
41+
* Creates a new {@link Parameter}.
4242
*/
43-
public RemoteConfigParameter() {
43+
public Parameter() {
4444
conditionalValues = new HashMap<>();
4545
}
4646

47-
RemoteConfigParameter(@NonNull ParameterResponse parameterResponse) {
47+
Parameter(@NonNull ParameterResponse parameterResponse) {
4848
checkNotNull(parameterResponse);
4949
this.conditionalValues = new HashMap<>();
5050
if (parameterResponse.getConditionalValues() != null) {
5151
for (Map.Entry<String, ParameterValueResponse> entry
5252
: parameterResponse.getConditionalValues().entrySet()) {
5353
this.conditionalValues.put(entry.getKey(),
54-
RemoteConfigParameterValue.fromParameterValueResponse(entry.getValue()));
54+
ParameterValue.fromParameterValueResponse(entry.getValue()));
5555
}
5656
}
5757
ParameterValueResponse responseDefaultValue = parameterResponse.getDefaultValue();
5858
this.defaultValue = (responseDefaultValue == null) ? null
59-
: RemoteConfigParameterValue.fromParameterValueResponse(responseDefaultValue);
59+
: ParameterValue.fromParameterValueResponse(responseDefaultValue);
6060
this.description = parameterResponse.getDescription();
6161
}
6262

6363
/**
6464
* Gets the default value of the parameter.
6565
*
66-
* @return A {@link RemoteConfigParameterValue} instance or null.
66+
* @return A {@link ParameterValue} instance or null.
6767
*/
6868
@Nullable
69-
public RemoteConfigParameterValue getDefaultValue() {
69+
public ParameterValue getDefaultValue() {
7070
return defaultValue;
7171
}
7272

@@ -83,12 +83,12 @@ public String getDescription() {
8383
/**
8484
* Gets the conditional values of the parameter.
8585
* The condition name of the highest priority (the one listed first in the
86-
* {@link RemoteConfigTemplate}'s conditions list) determines the value of this parameter.
86+
* {@link Template}'s conditions list) determines the value of this parameter.
8787
*
8888
* @return A non-null map of conditional values.
8989
*/
9090
@NonNull
91-
public Map<String, RemoteConfigParameterValue> getConditionalValues() {
91+
public Map<String, ParameterValue> getConditionalValues() {
9292
return conditionalValues;
9393
}
9494

@@ -97,10 +97,10 @@ public Map<String, RemoteConfigParameterValue> getConditionalValues() {
9797
* This is the value to set the parameter to, when none of the named conditions
9898
* evaluate to true.
9999
*
100-
* @param value An {@link RemoteConfigParameterValue} instance.
101-
* @return This {@link RemoteConfigParameter}.
100+
* @param value An {@link ParameterValue} instance.
101+
* @return This {@link Parameter}.
102102
*/
103-
public RemoteConfigParameter setDefaultValue(@Nullable RemoteConfigParameterValue value) {
103+
public Parameter setDefaultValue(@Nullable ParameterValue value) {
104104
defaultValue = value;
105105
return this;
106106
}
@@ -110,31 +110,31 @@ public RemoteConfigParameter setDefaultValue(@Nullable RemoteConfigParameterValu
110110
* Should not be over 100 characters and may contain any Unicode characters.
111111
*
112112
* @param description The description of the parameter.
113-
* @return This {@link RemoteConfigParameter}.
113+
* @return This {@link Parameter}.
114114
*/
115-
public RemoteConfigParameter setDescription(@Nullable String description) {
115+
public Parameter setDescription(@Nullable String description) {
116116
this.description = description;
117117
return this;
118118
}
119119

120120
/**
121121
* Sets the conditional values of the parameter.
122122
* The condition name of the highest priority (the one listed first in the
123-
* {@link RemoteConfigTemplate}'s conditions list) determines the value of this parameter.
123+
* {@link Template}'s conditions list) determines the value of this parameter.
124124
*
125125
* @param conditionalValues A non-null map of conditional values.
126-
* @return This {@link RemoteConfigParameter}.
126+
* @return This {@link Parameter}.
127127
*/
128-
public RemoteConfigParameter setConditionalValues(
129-
@NonNull Map<String, RemoteConfigParameterValue> conditionalValues) {
128+
public Parameter setConditionalValues(
129+
@NonNull Map<String, ParameterValue> conditionalValues) {
130130
checkNotNull(conditionalValues, "conditional values must not be null.");
131131
this.conditionalValues = conditionalValues;
132132
return this;
133133
}
134134

135135
ParameterResponse toParameterResponse() {
136136
Map<String, ParameterValueResponse> conditionalResponseValues = new HashMap<>();
137-
for (Map.Entry<String, RemoteConfigParameterValue> entry : conditionalValues.entrySet()) {
137+
for (Map.Entry<String, ParameterValue> entry : conditionalValues.entrySet()) {
138138
conditionalResponseValues.put(entry.getKey(), entry.getValue().toParameterValueResponse());
139139
}
140140
ParameterValueResponse defaultValueResponse = (defaultValue == null) ? null

src/main/java/com/google/firebase/remoteconfig/RemoteConfigParameterValue.java renamed to src/main/java/com/google/firebase/remoteconfig/ParameterValue.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,45 +22,45 @@
2222
import com.google.firebase.remoteconfig.internal.TemplateResponse.ParameterValueResponse;
2323

2424
/**
25-
* Represents a Remote Config parameter value that can be used in a {@link RemoteConfigTemplate}.
25+
* Represents a Remote Config parameter value that can be used in a {@link Template}.
2626
*/
27-
public abstract class RemoteConfigParameterValue {
27+
public abstract class ParameterValue {
2828

2929
/**
30-
* Creates a new {@link RemoteConfigParameterValue.Explicit} instance with the given value.
30+
* Creates a new {@link ParameterValue.Explicit} instance with the given value.
3131
*
32-
* @param value The value of the {@link RemoteConfigParameterValue.Explicit}.
33-
* @return A {@link RemoteConfigParameterValue.Explicit} instance.
32+
* @param value The value of the {@link ParameterValue.Explicit}.
33+
* @return A {@link ParameterValue.Explicit} instance.
3434
*/
3535
public static Explicit of(String value) {
3636
return new Explicit(value);
3737
}
3838

3939
/**
40-
* Creates a new {@link RemoteConfigParameterValue.InAppDefault} instance.
40+
* Creates a new {@link ParameterValue.InAppDefault} instance.
4141
*
42-
* @return A {@link RemoteConfigParameterValue.InAppDefault} instance.
42+
* @return A {@link ParameterValue.InAppDefault} instance.
4343
*/
4444
public static InAppDefault inAppDefault() {
4545
return new InAppDefault();
4646
}
4747

4848
abstract ParameterValueResponse toParameterValueResponse();
4949

50-
static RemoteConfigParameterValue fromParameterValueResponse(
50+
static ParameterValue fromParameterValueResponse(
5151
@NonNull ParameterValueResponse parameterValueResponse) {
5252
checkNotNull(parameterValueResponse);
5353
if (parameterValueResponse.isUseInAppDefault()) {
54-
return RemoteConfigParameterValue.inAppDefault();
54+
return ParameterValue.inAppDefault();
5555
}
56-
return RemoteConfigParameterValue.of(parameterValueResponse.getValue());
56+
return ParameterValue.of(parameterValueResponse.getValue());
5757
}
5858

5959
/**
6060
* Represents an explicit Remote Config parameter value with a {@link String} value that the
6161
* parameter is set to.
6262
*/
63-
public static final class Explicit extends RemoteConfigParameterValue {
63+
public static final class Explicit extends ParameterValue {
6464

6565
private final String value;
6666

@@ -69,7 +69,7 @@ private Explicit(String value) {
6969
}
7070

7171
/**
72-
* Gets the value of {@link RemoteConfigParameterValue.Explicit}.
72+
* Gets the value of {@link ParameterValue.Explicit}.
7373
*
7474
* @return The {@link String} value.
7575
*/
@@ -87,7 +87,7 @@ ParameterValueResponse toParameterValueResponse() {
8787
/**
8888
* Represents an in app default parameter value.
8989
*/
90-
public static final class InAppDefault extends RemoteConfigParameterValue {
90+
public static final class InAppDefault extends ParameterValue {
9191

9292
@Override
9393
ParameterValueResponse toParameterValueResponse() {

src/main/java/com/google/firebase/remoteconfig/RemoteConfigTemplate.java renamed to src/main/java/com/google/firebase/remoteconfig/Template.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,25 @@
2727
/**
2828
* Represents a Remote Config template.
2929
*/
30-
public final class RemoteConfigTemplate {
30+
public final class Template {
3131

3232
private String etag;
33-
private Map<String, RemoteConfigParameter> parameters;
33+
private Map<String, Parameter> parameters;
3434

3535
/**
36-
* Creates a new {@link RemoteConfigTemplate}.
36+
* Creates a new {@link Template}.
3737
*/
38-
public RemoteConfigTemplate() {
38+
public Template() {
3939
parameters = new HashMap<>();
4040
}
4141

42-
RemoteConfigTemplate(@NonNull TemplateResponse templateResponse) {
42+
Template(@NonNull TemplateResponse templateResponse) {
4343
checkNotNull(templateResponse);
4444
this.parameters = new HashMap<>();
4545
if (templateResponse.getParameters() != null) {
4646
for (Map.Entry<String, TemplateResponse.ParameterResponse> entry
4747
: templateResponse.getParameters().entrySet()) {
48-
this.parameters.put(entry.getKey(), new RemoteConfigParameter(entry.getValue()));
48+
this.parameters.put(entry.getKey(), new Parameter(entry.getValue()));
4949
}
5050
}
5151
}
@@ -66,7 +66,7 @@ public String getETag() {
6666
* conditional values.
6767
*/
6868
@NonNull
69-
public Map<String, RemoteConfigParameter> getParameters() {
69+
public Map<String, Parameter> getParameters() {
7070
return this.parameters;
7171
}
7272

@@ -75,23 +75,23 @@ public Map<String, RemoteConfigParameter> getParameters() {
7575
*
7676
* @param parameters A non-null map of parameter keys to their optional default values and
7777
* optional conditional values.
78-
* @return This {@link RemoteConfigTemplate} instance.
78+
* @return This {@link Template} instance.
7979
*/
80-
public RemoteConfigTemplate setParameters(
81-
@NonNull Map<String, RemoteConfigParameter> parameters) {
80+
public Template setParameters(
81+
@NonNull Map<String, Parameter> parameters) {
8282
checkNotNull(parameters, "parameters must not be null.");
8383
this.parameters = parameters;
8484
return this;
8585
}
8686

87-
RemoteConfigTemplate setETag(String etag) {
87+
Template setETag(String etag) {
8888
this.etag = etag;
8989
return this;
9090
}
9191

9292
TemplateResponse toTemplateResponse() {
9393
Map<String, TemplateResponse.ParameterResponse> parameterResponses = new HashMap<>();
94-
for (Map.Entry<String, RemoteConfigParameter> entry : parameters.entrySet()) {
94+
for (Map.Entry<String, Parameter> entry : parameters.entrySet()) {
9595
parameterResponses.put(entry.getKey(), entry.getValue().toParameterResponse());
9696
}
9797
return new TemplateResponse().setParameters(parameterResponses);

src/test/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigClientImplTest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,28 +84,28 @@ public void testGetTemplate() throws Exception {
8484
response.addHeader("etag", TEST_ETAG);
8585
response.setContent(MOCK_TEMPLATE_RESPONSE);
8686

87-
RemoteConfigTemplate template = client.getTemplate();
87+
Template template = client.getTemplate();
8888

8989
assertEquals(TEST_ETAG, template.getETag());
90-
Map<String, RemoteConfigParameter> parameters = template.getParameters();
90+
Map<String, Parameter> parameters = template.getParameters();
9191
assertEquals(2, parameters.size());
9292
assertTrue(parameters.containsKey("welcome_message_text"));
93-
RemoteConfigParameter welcomeMessageParameter = parameters.get("welcome_message_text");
93+
Parameter welcomeMessageParameter = parameters.get("welcome_message_text");
9494
assertEquals("text for welcome message!", welcomeMessageParameter.getDescription());
95-
RemoteConfigParameterValue.Explicit explicitDefaultValue =
96-
(RemoteConfigParameterValue.Explicit) welcomeMessageParameter.getDefaultValue();
95+
ParameterValue.Explicit explicitDefaultValue =
96+
(ParameterValue.Explicit) welcomeMessageParameter.getDefaultValue();
9797
assertEquals("welcome to app", explicitDefaultValue.getValue());
98-
Map<String, RemoteConfigParameterValue> conditionalValues = welcomeMessageParameter
98+
Map<String, ParameterValue> conditionalValues = welcomeMessageParameter
9999
.getConditionalValues();
100100
assertEquals(1, conditionalValues.size());
101101
assertTrue(conditionalValues.containsKey("ios_en"));
102-
RemoteConfigParameterValue.Explicit value =
103-
(RemoteConfigParameterValue.Explicit) conditionalValues.get("ios_en");
102+
ParameterValue.Explicit value =
103+
(ParameterValue.Explicit) conditionalValues.get("ios_en");
104104
assertEquals("welcome to app en", value.getValue());
105105
assertTrue(parameters.containsKey("header_text"));
106-
RemoteConfigParameter headerParameter = parameters.get("header_text");
106+
Parameter headerParameter = parameters.get("header_text");
107107
assertTrue(
108-
headerParameter.getDefaultValue() instanceof RemoteConfigParameterValue.InAppDefault);
108+
headerParameter.getDefaultValue() instanceof ParameterValue.InAppDefault);
109109
checkGetRequestHeader(interceptor.getLastRequest());
110110
}
111111

@@ -114,7 +114,7 @@ public void testGetTemplateWithEmptyTemplateResponse() throws Exception {
114114
response.addHeader("etag", TEST_ETAG);
115115
response.setContent("{}");
116116

117-
RemoteConfigTemplate template = client.getTemplate();
117+
Template template = client.getTemplate();
118118

119119
assertEquals(TEST_ETAG, template.getETag());
120120
assertEquals(0, template.getParameters().size());

0 commit comments

Comments
 (0)