Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/main/java/com/launchdarkly/client/FeatureRep.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.List;
import java.util.UUID;

class FeatureRep<E> {
public class FeatureRep<E> {
String name;
String key;
String salt;
Expand Down Expand Up @@ -63,7 +63,7 @@ public int hashCode() {
return result;
}

FeatureRep(Builder<E> b) {
public FeatureRep(Builder<E> b) {
this.name = b.name;
this.key = b.key;
this.salt = b.salt;
Expand Down Expand Up @@ -133,7 +133,7 @@ public E evaluate(LDUser user) {
return null;
}

static class Builder<E> {
public static class Builder<E> {
private String name;
private String key;
private boolean on;
Expand All @@ -142,40 +142,40 @@ static class Builder<E> {
private int version;
private List<Variation<E>> variations;

Builder(String name, String key) {
public Builder(String name, String key) {
this.on = true;
this.name = name;
this.key = key;
this.salt = UUID.randomUUID().toString();
this.variations = new ArrayList<>();
}

Builder<E> salt(String s) {
public Builder<E> salt(String s) {
this.salt = s;
return this;
}

Builder<E> on(boolean b) {
public Builder<E> on(boolean b) {
this.on = b;
return this;
}

Builder<E> variation(Variation<E> v) {
public Builder<E> variation(Variation<E> v) {
variations.add(v);
return this;
}

Builder<E> deleted(boolean d) {
public Builder<E> deleted(boolean d) {
this.deleted = d;
return this;
}

Builder<E> version(int v) {
public Builder<E> version(int v) {
this.version = v;
return this;
}

FeatureRep<E> build() {
public FeatureRep<E> build() {
return new FeatureRep<>(this);
}

Expand Down
18 changes: 9 additions & 9 deletions src/main/java/com/launchdarkly/client/Variation.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.util.ArrayList;
import java.util.List;

class Variation<E> {
public class Variation<E> {
E value;
int weight;
TargetRule userTarget;
Expand Down Expand Up @@ -82,36 +82,36 @@ public boolean matchTarget(LDUser user) {
return false;
}

static class Builder<E> {
public static class Builder<E> {
E value;
int weight;
TargetRule userTarget;
List<TargetRule> targets;

Builder(E value, int weight) {
public Builder(E value, int weight) {
this.value = value;
this.weight = weight;
this.userTarget = new TargetRule("key", "in", new ArrayList<JsonPrimitive>());
targets = new ArrayList<>();
}

Builder<E> userTarget(TargetRule rule) {
public Builder<E> userTarget(TargetRule rule) {
this.userTarget = rule;
return this;
}

Builder<E> target(TargetRule rule) {
public Builder<E> target(TargetRule rule) {
targets.add(rule);
return this;
}

Variation<E> build() {
public Variation<E> build() {
return new Variation<>(this);
}

}

static class TargetRule {
public static class TargetRule {
String attribute;
String operator;
List<JsonPrimitive> values;
Expand All @@ -122,13 +122,13 @@ public TargetRule() {

}

TargetRule(String attribute, String operator, List<JsonPrimitive> values) {
public TargetRule(String attribute, String operator, List<JsonPrimitive> values) {
this.attribute = attribute;
this.operator = operator;
this.values = new ArrayList<>(values);
}

TargetRule(String attribute, List<JsonPrimitive> values) {
public TargetRule(String attribute, List<JsonPrimitive> values) {
this(attribute, "in", values);
}

Expand Down