/** * Creates a response to a {@code RetrieveSubject} command. * * @param policyId the Policy ID of the retrieved subject. * @param label the Label of the PolicyEntry. * @param subject the retrieved Subject. * @param dittoHeaders the headers of the preceding command. * @return the response. * @throws NullPointerException if any argument is {@code null}. */ public static RetrieveSubjectResponse of(final String policyId, final Label label, final Subject subject, final DittoHeaders dittoHeaders) { return new RetrieveSubjectResponse(policyId, label, subject.getId().toString(), checkNotNull(subject, "Subject").toJson( dittoHeaders.getSchemaVersion().orElse(subject.getLatestSchemaVersion())), HttpStatusCode.OK, dittoHeaders); }
/** * Creates a response to a {@code RetrieveSubject} command. * * @param policyId the Policy ID of the retrieved subject. * @param label the Label of the PolicyEntry. * @param subject the retrieved Subject. * @param dittoHeaders the headers of the preceding command. * @return the response. * @throws NullPointerException if any argument is {@code null}. */ public static RetrieveSubjectResponse of(final String policyId, final Label label, final Subject subject, final DittoHeaders dittoHeaders) { return new RetrieveSubjectResponse(policyId, label, subject.getId().toString(), checkNotNull(subject, "Subject").toJson( dittoHeaders.getSchemaVersion().orElse(subject.getLatestSchemaVersion())), HttpStatusCode.OK, dittoHeaders); }