Skip to content

Commit a18e267

Browse files
authored
Add Features to SDK (#112)
1 parent 046b4c3 commit a18e267

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/**
2+
*
3+
* Copyright 2017, Optimizely and contributors
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package com.optimizely.ab.config;
18+
19+
import com.fasterxml.jackson.annotation.JsonCreator;
20+
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
21+
import com.fasterxml.jackson.annotation.JsonProperty;
22+
23+
import java.util.List;
24+
25+
/**
26+
* Represents a Feature definition at the project level
27+
*/
28+
@JsonIgnoreProperties(ignoreUnknown = true)
29+
public class Feature implements IdKeyMapped{
30+
31+
private final String id;
32+
private final String key;
33+
private final String layerId;
34+
private final List<String> experimentIds;
35+
private final List<LiveVariable> variables;
36+
37+
@JsonCreator
38+
public Feature(@JsonProperty("id") String id,
39+
@JsonProperty("key") String key,
40+
@JsonProperty("layerId") String layerId,
41+
@JsonProperty("experimentIds") List<String> experimentIds,
42+
@JsonProperty("variables") List<LiveVariable> variables) {
43+
this.id = id;
44+
this.key = key;
45+
this.layerId = layerId;
46+
this.experimentIds = experimentIds;
47+
this.variables = variables;
48+
}
49+
50+
public String getId() {
51+
return id;
52+
}
53+
54+
public String getKey() {
55+
return key;
56+
}
57+
58+
public String getLayerId() {
59+
return layerId;
60+
}
61+
62+
public List<String> getExperimentIds() {
63+
return experimentIds;
64+
}
65+
66+
public List<LiveVariable> getVariables() {
67+
return variables;
68+
}
69+
70+
@Override
71+
public String toString() {
72+
return "Feature{" +
73+
"id='" + id + '\'' +
74+
", key='" + key + '\'' +
75+
", layerId='" + layerId + '\'' +
76+
", experimentIds=" + experimentIds +
77+
", variables=" + variables +
78+
'}';
79+
}
80+
}

0 commit comments

Comments
 (0)