| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- package cz.senslog.analyzer.analysis;
- import java.util.ArrayList;
- import java.util.List;
- import static java.util.Collections.unmodifiableList;
- public class AnalyzerInfo {
- enum Status {
- }
- static class HandlerInfo {
- private final String name;
- private final Status status;
- private final String configHash;
- public HandlerInfo(String name, Status status, String configHash) {
- this.name = name;
- this.status = status;
- this.configHash = configHash;
- }
- public String getName() {
- return name;
- }
- public Status getStatus() {
- return status;
- }
- public String getConfigHash() {
- return configHash;
- }
- }
- public static Builder create(Status status) {
- return new BuilderImpl(status);
- }
- interface Builder {
- Builder addHandlerInfo(HandlerInfo handlerInfo);
- AnalyzerInfo get();
- }
- private static class BuilderImpl implements Builder {
- private List<HandlerInfo> handlers;
- private Status status;
- private BuilderImpl(Status status) {
- this.status = status;
- this.handlers = new ArrayList<>();
- }
- @Override
- public Builder addHandlerInfo(HandlerInfo handlerInfo) {
- handlers.add(handlerInfo);
- return this;
- }
- @Override
- public AnalyzerInfo get() {
- return new AnalyzerInfo(unmodifiableList(handlers), status);
- }
- }
- private final List<HandlerInfo> handlerInfos;
- private final Status status;
- private AnalyzerInfo(List<HandlerInfo> handlerInfos, Status status) {
- this.handlerInfos = handlerInfos;
- this.status = status;
- }
- public List<HandlerInfo> getHandlerInfos() {
- return handlerInfos;
- }
- public Status getStatus() {
- return status;
- }
- }
|