All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.satori.composer.stats.StatsJsonExt Maven / Gradle / Ivy

There is a newer version: 0.1.7
Show newest version
package com.satori.composer.stats;

import java.util.*;

import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.node.*;

public abstract class StatsJsonExt {
  @JsonIgnore
  HashMap ext = null;
  
  @JsonAnyGetter
  public Map ext() {
    return ext;
  }
  
  @JsonAnySetter
  public void ext(String name, JsonNode value) {
    if (ext == null) {
      ext = new HashMap<>();
    }
    ext.put(name, value);
  }
  
  
  public JsonNode ext(String name) {
    if (ext == null) {
      return null;
    }
    return ext.getOrDefault(name, null);
  }
  
  public void ext(String name, String value) {
    ext(name, JsonNodeFactory.instance.textNode(value));
  }
  
  public void ext(String name, Float value) {
    ext(name, JsonNodeFactory.instance.numberNode(value));
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy