private JsonObject asJSONObject()

in src/main/java/org/apache/sling/discovery/base/connectors/announcement/Announcement.java [243:275]


    private JsonObject asJSONObject(boolean filterTimes) {
        JsonObjectBuilder announcement = Json.createObjectBuilder();
        announcement.add("ownerId", ownerId);
        announcement.add("protocolVersion", protocolVersion);
        // SLING-3389: leaving the 'created' property in the announcement
        // for backwards compatibility!
        if (!filterTimes) {
            announcement.add("created", System.currentTimeMillis());
        }
        announcement.add("inherited", inherited);
        if (loop) {
            announcement.add("loop", loop);
        }
        if (serverInfo != null) {
            announcement.add("serverInfo", serverInfo);
        }
        if (localCluster!=null) {
            announcement.add("localClusterView", asJSON(localCluster));
        }
        if (!filterTimes && backoffInterval>0) {
            announcement.add("backoffInterval", backoffInterval);
        }
        if (resetBackoff) {
            announcement.add("resetBackoff", resetBackoff);
        }
        JsonArrayBuilder incomingAnnouncements = Json.createArrayBuilder();
        for (Iterator<Announcement> it = incomings.iterator(); it.hasNext();) {
            Announcement incoming = it.next();
            incomingAnnouncements.add(incoming.asJSONObject(filterTimes));
        }
        announcement.add("topologyAnnouncements", incomingAnnouncements);
        return announcement.build();
    }