<commit_before>package com.bazaarvoice.soa;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Maps;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.ISODateTimeFormat;

import java.util.Map;

import static com.google.common.base.Preconditions.checkNotNull;

public class ServiceEndPointJsonCodec {
    // All dates are represented in ISO-8601 format and in the UTC time zone.
    @VisibleForTesting
    static final DateTimeFormatter ISO8601 = ISODateTimeFormat.dateTime().withZoneUTC();

    public static String toJson(ServiceEndPoint endpoint) {
        DateTime now = DateTime.now().toDateTime(DateTimeZone.UTC);

        Map<String, Object> data = Maps.newLinkedHashMap();
        data.put("registration-time", ISO8601.print(now));
        data.put("name", endpoint.getServiceName());
        data.put("host", endpoint.getHostname());
        data.put("port", endpoint.getPort());
        data.put("payload", endpoint.getPayload());
        return JsonHelper.toJson(data);
    }

    public static ServiceEndPoint fromJson(String json) {
        Map<?, ?> data = JsonHelper.fromJson(json, Map.class);
        String name = (String) checkNotNull(data.get("name"));
        String host = (String) checkNotNull(data.get("host"));
        int port = ((Number) checkNotNull(data.get("port"))).intValue();
        String payload = (String) data.get("payload");

        return new ServiceEndPointBuilder()
                .withServiceName(name)
                .withHostname(host)
                .withPort(port)
                .withPayload(payload)
                .build();
    }
}<commit_msg>Make ServiceEndPointJsonCode not instantiable.<commit_after>package com.bazaarvoice.soa;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Maps;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.ISODateTimeFormat;

import java.util.Map;

import static com.google.common.base.Preconditions.checkNotNull;

public final class ServiceEndPointJsonCodec {
    // All dates are represented in ISO-8601 format and in the UTC time zone.
    @VisibleForTesting
    static final DateTimeFormatter ISO8601 = ISODateTimeFormat.dateTime().withZoneUTC();

    public static String toJson(ServiceEndPoint endpoint) {
        DateTime now = DateTime.now().toDateTime(DateTimeZone.UTC);

        Map<String, Object> data = Maps.newLinkedHashMap();
        data.put("registration-time", ISO8601.print(now));
        data.put("name", endpoint.getServiceName());
        data.put("host", endpoint.getHostname());
        data.put("port", endpoint.getPort());
        data.put("payload", endpoint.getPayload());
        return JsonHelper.toJson(data);
    }

    public static ServiceEndPoint fromJson(String json) {
        Map<?, ?> data = JsonHelper.fromJson(json, Map.class);
        String name = (String) checkNotNull(data.get("name"));
        String host = (String) checkNotNull(data.get("host"));
        int port = ((Number) checkNotNull(data.get("port"))).intValue();
        String payload = (String) data.get("payload");

        return new ServiceEndPointBuilder()
                .withServiceName(name)
                .withHostname(host)
                .withPort(port)
                .withPayload(payload)
                .build();
    }

    // Private, not instantiable.
    private ServiceEndPointJsonCodec() {}
}
{'fraction_non_alphanumeric': 0.12296918767507002, 'fraction_numerical': 0.0067226890756302525, 'mean_word_length': 3.2664277180406214, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '938597', 'n_tokens_mistral': 1016, 'n_tokens_neox': 984, 'n_words': 205}