public class DataUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsKey(Map<String,Object> data,
String path)
Returns true if the specified key is present in the map.
|
static boolean |
containsKey(Map<String,Object> data,
String path,
boolean propagateNull)
Returns true if the specified key is present in the map.
|
static List<CdsData> |
copyGenericList(List original) |
static Map<String,Object> |
copyMap(Map<String,?> original) |
static DataUtils |
create(Supplier<SessionContext> session,
int timestampPrecision) |
static void |
createPath(Map<String,Object> map,
String path,
boolean notNull) |
static List<Instant> |
dateTimeValues(List<Instant> instants) |
static Stream<String> |
deepMapKeys(Map<String,?> map) |
Object |
defaultValue(CdsElement e) |
static boolean |
generateUuidKeys(CdsStructuredType struct,
Map<String,Object> data) |
static <T> T |
getOrDefault(Map<String,Object> data,
String path,
T defaultValue)
Returns the value to which the specified key is mapped.
|
static <T> T |
getPath(Map<String,Object> d,
String[] segment) |
static <T> T |
getPathOrDefault(Map<String,Object> data,
String path,
T defaultValue)
Returns the value to which the specified path is mapped.
|
static <T> T |
getPathOrDefault(T defaultValue,
Map<String,Object> d,
String[] segment) |
static boolean |
hasDefaultValue(CdsElement element,
CdsType type) |
static boolean |
hasManagedUuidValue(CdsElement element) |
static boolean |
hasNonKeyValues(CdsStructuredType type,
Map<String,Object> data) |
static boolean |
isDeep(CdsStructuredType type,
Collection<Map<String,Object>> entries) |
static boolean |
isFkUpdate(CdsElement assoc,
Map<String,Object> data,
SessionContext session) |
static Map<String,Object> |
keyValues(CdsEntity entity,
Map<String,Object> data)
Extracts the key values for the given entity from the data map.
|
static void |
merge(List<? extends Map<String,Object>> source,
List<? extends Map<String,Object>> target,
String expRefName,
Map<String,String> mapping,
String fkPrefix) |
static void |
normalizedUuidKeys(CdsStructuredType type,
Iterable<? extends Map<String,Object>> entries) |
void |
prepareForInsert(CdsStructuredType struct,
List<? extends Map<String,Object>> entries) |
void |
prepareForUpdate(CdsStructuredType struct,
List<? extends Map<String,Object>> entries) |
void |
processOnInsert(CdsStructuredType struct,
Iterable<? extends Map<String,Object>> data) |
void |
processOnUpdate(CdsStructuredType struct,
Iterable<? extends Map<String,Object>> data,
boolean deep) |
static Object |
putPath(Map<String,Object> map,
String key,
Object value) |
static Object |
putPath(Map<String,Object> map,
String key,
Object value,
boolean createMaps) |
void |
removeOpenTypeElements(CdsStructuredType struct,
Iterable<? extends Map<String,Object>> data) |
static <T> T |
removePath(Map<String,Object> data,
String path,
boolean removeEmptyMaps) |
void |
removeVirtualElements(CdsStructuredType struct,
List<? extends Map<String,Object>> data) |
static void |
resolvePathAndAdd(Map<String,Object> map,
String key,
Object value) |
static void |
resolvePaths(CdsEntity entity,
List<? extends Map<String,Object>> entries) |
static List<Instant> |
timestampValues(List<Instant> instants,
int precision) |
static boolean |
uniformData(CdsStructuredType type,
Collection<Map<String,Object>> entries) |
public static DataUtils create(Supplier<SessionContext> session, int timestampPrecision)
public static boolean isDeep(CdsStructuredType type, Collection<Map<String,Object>> entries)
public static boolean hasNonKeyValues(CdsStructuredType type, Map<String,Object> data)
public static boolean uniformData(CdsStructuredType type, Collection<Map<String,Object>> entries)
public void prepareForInsert(CdsStructuredType struct, List<? extends Map<String,Object>> entries)
public void prepareForUpdate(CdsStructuredType struct, List<? extends Map<String,Object>> entries)
public void processOnInsert(CdsStructuredType struct, Iterable<? extends Map<String,Object>> data)
public void processOnUpdate(CdsStructuredType struct, Iterable<? extends Map<String,Object>> data, boolean deep)
public static void resolvePaths(CdsEntity entity, List<? extends Map<String,Object>> entries)
public static boolean hasDefaultValue(CdsElement element, CdsType type)
public Object defaultValue(CdsElement e)
public static void resolvePathAndAdd(Map<String,Object> map, String key, Object value)
public static Object putPath(Map<String,Object> map, String key, Object value, boolean createMaps)
public static boolean generateUuidKeys(CdsStructuredType struct, Map<String,Object> data)
public static boolean hasManagedUuidValue(CdsElement element)
public static void normalizedUuidKeys(CdsStructuredType type, Iterable<? extends Map<String,Object>> entries)
public void removeVirtualElements(CdsStructuredType struct, List<? extends Map<String,Object>> data)
public void removeOpenTypeElements(CdsStructuredType struct, Iterable<? extends Map<String,Object>> data)
public static void merge(List<? extends Map<String,Object>> source, List<? extends Map<String,Object>> target, String expRefName, Map<String,String> mapping, String fkPrefix)
public static Map<String,Object> keyValues(CdsEntity entity, Map<String,Object> data)
entity - the entitydata - the data mappublic static <T> T getOrDefault(Map<String,Object> data, String path, T defaultValue)
T - the type to which the value is casteddata - the data mappath - the path or key whose associated value is to be returneddefaultValue - the default mapping of the keypublic static <T> T getPathOrDefault(Map<String,Object> data, String path, T defaultValue)
T - the type to which the value is casteddata - the data mappath - the path with dot separator whose associated value is to
be returneddefaultValue - the default mapping of the keypublic static <T> T getPathOrDefault(T defaultValue,
Map<String,Object> d,
String[] segment)
public static <T> T removePath(Map<String,Object> data, String path, boolean removeEmptyMaps)
public static boolean containsKey(Map<String,Object> data, String path)
data - the data mappath - the path or key to be checkedpublic static boolean containsKey(Map<String,Object> data, String path, boolean propagateNull)
data - the data mappath - the path or key to be checkedpropagateNull - true, if explicit null values should be considered propagating, meaning
all values from that key-level on are considered explicitly set to nullpublic static boolean isFkUpdate(CdsElement assoc, Map<String,Object> data, SessionContext session)
Copyright © 2023 SAP. All rights reserved.