org.zodiac.monitor.console.model.Info Maven / Gradle / Ivy
package org.zodiac.monitor.console.model;
import java.io.Serializable;
import java.util.Collections;
import java.util.Map;
import org.springframework.lang.Nullable;
import org.zodiac.commons.util.Colls;
import org.zodiac.sdk.toolkit.util.collection.CollUtil;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
/**
* Represents the info fetched from the info actuator endpoint
*
* @author Johannes Edmeier
* @author zodiac
*/
public class Info implements Serializable {
private static final long serialVersionUID = -8642650017553447898L;
private static final Info EMPTY = new Info(Collections.emptyMap());
private final Map values;
private Info(Map values) {
this.values = CollUtil.isEmptyMap(values) ? Collections.emptyMap() : Collections.unmodifiableMap(CollUtil.concurrentMap(values));
}
public static Info from(@Nullable Map values) {
if (values == null || values.isEmpty()) {
return empty();
}
return new Info(values);
}
public static Info empty() {
return EMPTY;
}
@JsonAnyGetter
public Map getValues() {
return this.values;
}
}