use of com.google.cloud.spanner.Type.StructField in project jans by JanssenProject.
the class SpannerConnectionProvider method getTableMappingByKey.
public TableMapping getTableMappingByKey(String key, String objectClass, String tableName) {
Map<String, StructField> columTypes = tableColumnsMap.get(tableName);
if (!tableColumnsMap.containsKey(tableName)) {
throw new MappingException(String.format("Table '%s' metadata is not exists '", tableName));
}
if ("_".equals(key)) {
return new TableMapping("", tableName, objectClass, columTypes);
}
String[] baseNameParts = key.split("_");
if (ArrayHelper.isEmpty(baseNameParts)) {
throw new KeyConversionException("Failed to determine base key part!");
}
TableMapping tableMapping = new TableMapping(baseNameParts[0], tableName, objectClass, columTypes);
return tableMapping;
}
Aggregations