/** * Returns the replacement value for a {@literal null} value in a map. */ private Object computeFieldValueIfPresent(String key, Object oldValue) { String term = term(key); String container = context.getContainer(term); if (container == null || container.isEmpty() || container.equals(JsonLdConsts.NONE)) { return null; } else { return oldValue; } }
/** * Converts a JSON-LD field value into a Java representation. */ public Object fromFieldValue(String term, @Nullable Object input) { return _fromFieldValue(term, input).collect(valueMapper.getCollector(context.getContainer(term))); }
/** * Produces value for serialization into the specified JSON-LD term. */ public Object toFieldValue(String term, @Nullable Object input) { return valueMapper.split(input).map(e -> _toFieldValue(term, e)).collect(jsonLdCollector(context.getContainer(term))); }
/** * Returns an operator for merging a non-{@literal null} value in a map. */ private BinaryOperator<Object> mergeFieldValue(String key) { return (oldValue, input) -> { Objects.requireNonNull(input); String term = term(key); String container = context.getContainer(term); if (oldValue == null || container == null || container.isEmpty() || container.equals(JsonLdConsts.NONE)) { return toFieldValue(term, input); } else { Object newValue = toFieldValue(term, input); Stream<?> newValues = newValue instanceof List<?> ? ((List<?>) newValue).stream() : Stream.of(newValue); Stream<?> oldValues = oldValue instanceof List<?> ? ((List<?>) oldValue).stream() : Stream.of(oldValue); return Streams.concat(newValues, oldValues).collect(jsonLdCollector(context.getContainer(term))); } }; }
final String container = ctx.getContainer(prop); if (opts.getCompactArrays() && isArray(result) && ((List<Object>) result).size() == 1 && container == null) {
if (value.containsKey("@index") && "@index".equals(this.getContainer(activeProperty))) { numberMembers--;
final String container = ctx.getContainer(prop); if (opts.getCompactArrays() && isArray(result) && ((List<Object>) result).size() == 1 && container == null) {
&& JsonLdConsts.INDEX.equals(this.getContainer(activeProperty))) { numberMembers--;
final String container = ctx.getContainer(prop); if (opts.getCompactArrays() && isArray(result) && ((List<Object>) result).size() == 1 && container == null) {
&& JsonLdConsts.INDEX.equals(this.getContainer(activeProperty))) { numberMembers--;
&& activeCtx.getContainer(activeProperty) == null) { return result.get(0); if (("@set".equals(activeCtx.getContainer(property)) || !compactArrays) && !(value instanceof List)) { final List<Object> tmp = new ArrayList<>(); && "@index".equals(activeCtx.getContainer(activeProperty))) { continue; expandedItem, true, insideReverse); final String container = activeCtx.getContainer(itemActiveProperty);
&& activeCtx.getContainer(activeProperty) == null) { return result.get(0); || !(activeCtx.getContainer(alias) != null && activeCtx .getContainer(alias).equals(JsonLdConsts.SET)))) { compactedValue = types.get(0); } else { if ((JsonLdConsts.SET.equals(activeCtx.getContainer(property)) || !compactArrays) && !(value instanceof List)) { final List<Object> tmp = new ArrayList<Object>(); && JsonLdConsts.INDEX.equals(activeCtx.getContainer(activeProperty))) { continue; expandedItem, true, insideReverse); final String container = activeCtx.getContainer(itemActiveProperty);
&& activeCtx.getContainer(activeProperty) == null) { return result.get(0); || !(activeCtx.getContainer(alias) != null && activeCtx .getContainer(alias).equals(JsonLdConsts.SET)))) { compactedValue = types.get(0); } else { if ((JsonLdConsts.SET.equals(activeCtx.getContainer(property)) || !compactArrays) && !(value instanceof List)) { final List<Object> tmp = new ArrayList<Object>(); && JsonLdConsts.INDEX.equals(activeCtx.getContainer(activeProperty))) { continue; expandedItem, true, insideReverse); final String container = activeCtx.getContainer(itemActiveProperty);
.getContainer(activeProperty))) && (v instanceof List || (v instanceof Map && ((Map<String, Object>) v) .containsKey("@list")))) { else if ("@language".equals(activeCtx.getContainer(key)) && value instanceof Map) { else if ("@index".equals(activeCtx.getContainer(key)) && value instanceof Map) { if ("@list".equals(activeCtx.getContainer(key))) { if (!(expandedValue instanceof Map) || !((Map<String, Object>) expandedValue).containsKey("@list")) {
|| JsonLdConsts.LIST.equals(activeCtx.getContainer(activeProperty))) && (v instanceof List || (v instanceof Map && ((Map<String, Object>) v).containsKey(JsonLdConsts.LIST)))) { else if (JsonLdConsts.LANGUAGE.equals(activeCtx.getContainer(key)) && value instanceof Map) { else if (JsonLdConsts.INDEX.equals(activeCtx.getContainer(key)) && value instanceof Map) { if (JsonLdConsts.LIST.equals(activeCtx.getContainer(key))) { if (!(expandedValue instanceof Map) || !((Map<String, Object>) expandedValue) .containsKey(JsonLdConsts.LIST)) {
|| JsonLdConsts.LIST.equals(activeCtx.getContainer(activeProperty))) && (v instanceof List || (v instanceof Map && ((Map<String, Object>) v).containsKey(JsonLdConsts.LIST)))) { else if (JsonLdConsts.LANGUAGE.equals(activeCtx.getContainer(key)) && value instanceof Map) { else if (JsonLdConsts.INDEX.equals(activeCtx.getContainer(key)) && value instanceof Map) { if (JsonLdConsts.LIST.equals(activeCtx.getContainer(key))) { if (!(expandedValue instanceof Map) || !((Map<String, Object>) expandedValue) .containsKey(JsonLdConsts.LIST)) {