use of com.hazelcast.sql.impl.schema.map.MapTableField in project hazelcast by hazelcast.
the class KvMetadataJavaResolver method resolveObjectMetadata.
private KvMetadata resolveObjectMetadata(boolean isKey, List<MappingField> resolvedFields, Map<QueryPath, MappingField> fieldsByPath, Class<?> clazz) {
Map<String, Class<?>> typesByNames = FieldsUtil.resolveClass(clazz);
List<TableField> fields = new ArrayList<>();
Map<String, String> typeNamesByPaths = new HashMap<>();
for (Entry<QueryPath, MappingField> entry : fieldsByPath.entrySet()) {
QueryPath path = entry.getKey();
QueryDataType type = entry.getValue().type();
String name = entry.getValue().name();
fields.add(new MapTableField(name, type, false, path));
if (path.getPath() != null && typesByNames.get(path.getPath()) != null) {
typeNamesByPaths.put(path.getPath(), typesByNames.get(path.getPath()).getName());
}
}
maybeAddDefaultField(isKey, resolvedFields, fields, QueryDataType.OBJECT);
return new KvMetadata(fields, GenericQueryTargetDescriptor.DEFAULT, new PojoUpsertTargetDescriptor(clazz.getName(), typeNamesByPaths));
}
use of com.hazelcast.sql.impl.schema.map.MapTableField in project hazelcast by hazelcast.
the class KvMetadataJsonResolver method resolveMetadata.
@Override
public KvMetadata resolveMetadata(boolean isKey, List<MappingField> resolvedFields, Map<String, String> options, InternalSerializationService serializationService) {
Map<QueryPath, MappingField> fieldsByPath = extractFields(resolvedFields, isKey);
List<TableField> fields = new ArrayList<>();
for (Entry<QueryPath, MappingField> entry : fieldsByPath.entrySet()) {
QueryPath path = entry.getKey();
QueryDataType type = entry.getValue().type();
String name = entry.getValue().name();
fields.add(new MapTableField(name, type, false, path));
}
maybeAddDefaultField(isKey, resolvedFields, fields, QueryDataType.OBJECT);
return new KvMetadata(fields, JsonQueryTargetDescriptor.INSTANCE, JsonUpsertTargetDescriptor.INSTANCE);
}
Aggregations