Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
71 changes: 71 additions & 0 deletions core-api/src/main/java/com/optimizely/ab/config/Layer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/**
*
* Copyright 2017, Optimizely and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.optimizely.ab.config;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;

import javax.annotation.concurrent.Immutable;

/**
* Represents a Optimizely Layer configuration
*
* @see <a href="http://developers.optimizely.com/server/reference/index.html#json">Project JSON</a>
*/
@Immutable
@JsonIgnoreProperties(ignoreUnknown = true)
public class Layer implements IdMapped {

protected final String id;
protected final String policy;
protected final List<Experiment> experiments;

public static final String SINGLE_EXPERIMENT_POLICY = "single_experiment";

@JsonCreator
public Layer(@JsonProperty("id") String id,
@JsonProperty("policy") String policy,
@JsonProperty("experiments") List<Experiment> experiments) {
this.id = id;
this.policy = policy;
this.experiments = experiments;
}

public String getId() {
return id;
}

public String getPolicy() {
return policy;
}

public List<Experiment> getExperiments() {
return experiments;
}

@Override
public String toString() {
return "Layer{" +
"id='" + id + '\'' +
", policy='" + policy + '\'' +
", experiments=" + experiments +
'}';
}
}
44 changes: 44 additions & 0 deletions core-api/src/main/java/com/optimizely/ab/config/Rollout.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
*
* Copyright 2017, Optimizely and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.optimizely.ab.config;

import javax.annotation.concurrent.Immutable;
import java.util.List;

/**
* Represents a Optimizely Rollout configuration
*
* @see <a href="http://developers.optimizely.com/server/reference/index.html#json">Project JSON</a>
*/
@Immutable
public class Rollout extends Layer implements IdMapped {

public Rollout(String id,
String policy,
List<Experiment> experiments) {
super(id, policy, experiments);
}

@Override
public String toString() {
return "Rollout{" +
"id='" + id + '\'' +
", policy='" + policy + '\'' +
", experiments=" + experiments +
'}';
}
}