use of com.fasterxml.jackson.annotation.JsonValue in project druid by druid-io.
the class ApproximateHistogram method toBytes.
/**
* Returns a byte-array representation of this ApproximateHistogram object
*
* @return byte array representation
*/
@JsonValue
public byte[] toBytes() {
ByteBuffer buf = ByteBuffer.allocate(getMinStorageSize());
toBytes(buf);
return buf.array();
}
use of com.fasterxml.jackson.annotation.JsonValue in project druid by druid-io.
the class Histogram method toBytes.
@JsonValue
public byte[] toBytes() {
ByteBuffer buf = ByteBuffer.allocate(Integer.BYTES + Float.BYTES * breaks.length + Long.BYTES * bins.length + Float.BYTES * 2);
buf.putInt(breaks.length);
for (float b : breaks) {
buf.putFloat(b);
}
for (long c : bins) {
buf.putLong(c);
}
buf.putFloat(min);
buf.putFloat(max);
return buf.array();
}
use of com.fasterxml.jackson.annotation.JsonValue in project graylog2-server by Graylog2.
the class ConfigurationRequest method asList.
@JsonValue
public Map<String, Map<String, Object>> asList() {
final Map<String, Map<String, Object>> configs = Maps.newLinkedHashMap();
for (ConfigurationField f : fields.values()) {
final Map<String, Object> config = Maps.newHashMap();
config.put("type", f.getFieldType());
config.put("human_name", f.getHumanName());
config.put("description", f.getDescription());
config.put("default_value", f.getDefaultValue());
config.put("is_optional", f.isOptional().equals(ConfigurationField.Optional.OPTIONAL));
config.put("attributes", f.getAttributes());
config.put("additional_info", f.getAdditionalInformation());
config.put("position", f.getPosition());
configs.put(f.getName(), config);
}
return configs;
}
Aggregations