use of com.unboundid.util.json.JSONException in project ldapsdk by pingidentity.
the class EqualsAnyJSONObjectFilter method decodeFilter.
/**
* {@inheritDoc}
*/
@Override()
@NotNull()
protected EqualsAnyJSONObjectFilter decodeFilter(@NotNull final JSONObject filterObject) throws JSONException {
final List<String> fieldPath = getStrings(filterObject, FIELD_FIELD_PATH, false, null);
final boolean isCaseSensitive = getBoolean(filterObject, FIELD_CASE_SENSITIVE, false);
final JSONValue arrayValue = filterObject.getField(FIELD_VALUES);
if (arrayValue instanceof JSONArray) {
return new EqualsAnyJSONObjectFilter(fieldPath, ((JSONArray) arrayValue).getValues(), isCaseSensitive);
} else {
throw new JSONException(ERR_OBJECT_FILTER_VALUE_NOT_ARRAY.get(String.valueOf(filterObject), FILTER_TYPE, FIELD_VALUES));
}
}
use of com.unboundid.util.json.JSONException in project ldapsdk by pingidentity.
the class JSONLDAPResultWriter method toJSON.
/**
* Encodes the provided search result reference as a JSON object.
*
* @param ref The search result reference to be encoded as a JSON object.
* It must not be {@code null}.
*
* @return The JSON object containing the encoded representation of the
* search result reference.
*/
@NotNull()
public static JSONObject toJSON(@NotNull final SearchResultReference ref) {
try {
final JSONBuffer jsonBuffer = new JSONBuffer();
toJSON(ref, jsonBuffer);
return jsonBuffer.toJSONObject();
} catch (final JSONException e) {
// This should never happen.
Debug.debugException(e);
throw new LDAPRuntimeException(new LDAPException(ResultCode.ENCODING_ERROR, e.getMessage(), e));
}
}
Aggregations