1 package io.getunleash.repository;
2
3 import io.getunleash.FeatureToggle;
4 import io.getunleash.Segment;
5 import java.util.Collections;
6
7 public final class FeatureCollection {
8
9     private final ToggleCollection toggleCollection;
10     private final SegmentCollection segmentCollection;
11
12     public FeatureCollection() {
13         this(
14                 new ToggleCollection(Collections.emptyList()),
15                 new SegmentCollection(Collections.emptyList()));
16     }
17
18     public FeatureCollection(
19             ToggleCollection toggleCollection, SegmentCollection segmentCollection) {
20         this.toggleCollection = toggleCollection;
21         this.segmentCollection = segmentCollection;
22     }
23
24     public ToggleCollection getToggleCollection() {
25         return toggleCollection;
26     }
27
28     public SegmentCollection getSegmentCollection() {
29         return segmentCollection;
30     }
31
32     public FeatureToggle getToggle(String name) {
33         return toggleCollection.getToggle(name);
34     }
35
36     public Segment getSegment(int id) {
37         return segmentCollection.getSegment(id);
38     }
39 }
40