use of com.linkedin.data.DataMap in project rest.li by linkedin.
the class BatchCreateIdEntityResponse method generateDataMap.
private static DataMap generateDataMap(List<? extends RecordTemplate> elements) {
DataMap dataMap = new DataMap();
DataList listElements = new DataList();
for (RecordTemplate recordTemplate : elements) {
CreateIdEntityStatus<?, ?> status = (CreateIdEntityStatus) recordTemplate;
CheckedUtil.addWithoutChecking(listElements, status.data());
}
dataMap.put(CollectionResponse.ELEMENTS, listElements);
return dataMap;
}
use of com.linkedin.data.DataMap in project rest.li by linkedin.
the class BatchCreateIdResponse method generateDataMap.
private static DataMap generateDataMap(List<? extends RecordTemplate> elements) {
DataMap dataMap = new DataMap();
DataList listElements = new DataList();
for (RecordTemplate recordTemplate : elements) {
CheckedUtil.addWithoutChecking(listElements, recordTemplate.data());
}
dataMap.put(CollectionResponse.ELEMENTS, listElements);
return dataMap;
}
use of com.linkedin.data.DataMap in project rest.li by linkedin.
the class BatchCreateResponse method generateDataMap.
private static DataMap generateDataMap(List<? extends RecordTemplate> elements) {
DataMap dataMap = new DataMap();
DataList listElements = new DataList();
for (RecordTemplate recordTemplate : elements) {
listElements.add(recordTemplate.data());
}
dataMap.put(CollectionResponse.ELEMENTS, listElements);
return dataMap;
}
use of com.linkedin.data.DataMap in project rest.li by linkedin.
the class BatchCreateResponse method createCollectionFromDecoder.
private List<CreateStatus> createCollectionFromDecoder(CreateIdStatusDecoder<K> entityDecoder) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
DataList elements = this.data().getDataList(CollectionResponse.ELEMENTS);
List<CreateStatus> collection = new ArrayList<CreateStatus>(elements.size());
for (Object obj : elements) {
DataMap dataMap = (DataMap) obj;
collection.add(decodeValue(dataMap, entityDecoder));
}
return collection;
}
use of com.linkedin.data.DataMap in project rest.li by linkedin.
the class ComplexResourceKey method buildFromDataMap.
/**
* Build complex key instance from an untyped datamap representing a complex key as
* defined in {@link QueryParamsDataMap}
*
* @param keyDataMap untyped DataMap - all primitive values are represented as strings.
* @param complexKeyType type of {@link ComplexResourceKey}
* @return {@link ComplexResourceKey} initialized with id and param values specified in
* the input DataMap
*/
public static ComplexResourceKey<RecordTemplate, RecordTemplate> buildFromDataMap(DataMap keyDataMap, ComplexKeySpec<?, ?> complexKeyType) {
// Copy in case the original is immutable
keyDataMap = new DataMap(keyDataMap);
// Separate key from its parameters (those are under "params" key in the total map)
DataMap paramsDataMap = (DataMap) keyDataMap.remove(COMPLEX_KEY_PARAMS);
if (paramsDataMap == null) {
paramsDataMap = new DataMap();
}
RecordTemplate key = validateDataMap(keyDataMap, complexKeyType.getKeyType());
RecordTemplate params = validateDataMap(paramsDataMap, complexKeyType.getParamsType());
return new ComplexResourceKey<RecordTemplate, RecordTemplate>(key, params);
}
Aggregations