Search in sources :

Example 11 with JsonValue

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();
}
Also used : ByteBuffer(java.nio.ByteBuffer) JsonValue(com.fasterxml.jackson.annotation.JsonValue)

Example 12 with JsonValue

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();
}
Also used : ByteBuffer(java.nio.ByteBuffer) JsonValue(com.fasterxml.jackson.annotation.JsonValue)

Example 13 with JsonValue

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;
}
Also used : ConfigurationField(org.graylog2.plugin.configuration.fields.ConfigurationField) Map(java.util.Map) JsonValue(com.fasterxml.jackson.annotation.JsonValue)

Aggregations

JsonValue (com.fasterxml.jackson.annotation.JsonValue)13 ByteBuffer (java.nio.ByteBuffer)8 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 ByteArrayDataOutput (com.google.common.io.ByteArrayDataOutput)1 Integer.toHexString (java.lang.Integer.toHexString)1 Map (java.util.Map)1 Nonnull (javax.annotation.Nonnull)1 ConfigSource (org.embulk.config.ConfigSource)1 ConfigurationField (org.graylog2.plugin.configuration.fields.ConfigurationField)1