class LoadCodec extends JsonCodec<Load> {

    @Override
    public ObjectNode encode(Load load, CodecContext context) {
        checkNotNull(load, "Load cannot be null");
        return context.mapper().createObjectNode()
                .put(RATE, load.rate())
                .put(LATEST, load.latest())
                .put(VALID, load.isValid())
                .put(TIME, load.time());
    }

}