From 9d7f9fbc95e6f36289c7b7077f43acc784cefad0 Mon Sep 17 00:00:00 2001 From: Andrey Alekseev Date: Thu, 16 Jan 2025 14:31:17 +0300 Subject: [PATCH] Change naming --- .../src/main/java/tech/ydb/yoj/databind/schema/Column.java | 6 +++--- .../schema/naming/AnnotationFirstNamingStrategy.java | 6 +++--- .../tech/ydb/yoj/databind/schema/naming/MixedEntity.java | 2 +- .../tech/ydb/yoj/databind/schema/naming/TestEntity.java | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/databind/src/main/java/tech/ydb/yoj/databind/schema/Column.java b/databind/src/main/java/tech/ydb/yoj/databind/schema/Column.java index 3c458c8..49069f5 100644 --- a/databind/src/main/java/tech/ydb/yoj/databind/schema/Column.java +++ b/databind/src/main/java/tech/ydb/yoj/databind/schema/Column.java @@ -81,16 +81,16 @@ @ExperimentalApi(issue = "https://github.com/ydb-platform/yoj-project/issues/24") CustomValueType customValueType() default @CustomValueType(columnClass = Comparable.class, converter = NoConverter.class); - enum NamingStrategy { + enum ColumnNaming { @Deprecated LEGACY, ABSOLUTE, RELATIVE } /** - * LEGACY - Use parent name as prefix only if current(child) doesn't specify name explicityly + * LEGACY - Use parent name as prefix only if current(child) doesn't specify name explicitly * ABSOLUTE - Use only current name, don't add prent name as prefix * RELATIVE - Use current name and add parent name as prefix */ - NamingStrategy namingStrategy() default NamingStrategy.LEGACY; + ColumnNaming columnNaming() default ColumnNaming.LEGACY; } diff --git a/databind/src/main/java/tech/ydb/yoj/databind/schema/naming/AnnotationFirstNamingStrategy.java b/databind/src/main/java/tech/ydb/yoj/databind/schema/naming/AnnotationFirstNamingStrategy.java index b064057..2b6ef90 100644 --- a/databind/src/main/java/tech/ydb/yoj/databind/schema/naming/AnnotationFirstNamingStrategy.java +++ b/databind/src/main/java/tech/ydb/yoj/databind/schema/naming/AnnotationFirstNamingStrategy.java @@ -40,11 +40,11 @@ private String getColumnName(Schema.JavaField field) { var name = (annotation.name().isEmpty()) ? field.getField().getName() : annotation.name(); - if (annotation.namingStrategy() == Column.NamingStrategy.ABSOLUTE) { + if (annotation.columnNaming() == Column.ColumnNaming.ABSOLUTE) { return name; - } else if (annotation.namingStrategy() == Column.NamingStrategy.RELATIVE) { + } else if (annotation.columnNaming() == Column.ColumnNaming.RELATIVE) { return parentName + NAME_DELIMITER + name; - } else { // annotation.namingStrategy() == Column.NamingStrategy.LEGACY + } else { // annotation.columnNaming() == Column.ColumnNaming.LEGACY if (!annotation.name().isEmpty()) { return annotation.name(); } diff --git a/databind/src/test/java/tech/ydb/yoj/databind/schema/naming/MixedEntity.java b/databind/src/test/java/tech/ydb/yoj/databind/schema/naming/MixedEntity.java index e3e3b9c..2345feb 100644 --- a/databind/src/test/java/tech/ydb/yoj/databind/schema/naming/MixedEntity.java +++ b/databind/src/test/java/tech/ydb/yoj/databind/schema/naming/MixedEntity.java @@ -27,7 +27,7 @@ private static class Id { @Value static class SubEntityWithRelative { - @Column(name = "sfe_relative", namingStrategy = Column.NamingStrategy.RELATIVE) + @Column(name = "sfe_relative", columnNaming = Column.ColumnNaming.RELATIVE) SingleFieldEntity singleFieldEntityRelative; } } diff --git a/databind/src/test/java/tech/ydb/yoj/databind/schema/naming/TestEntity.java b/databind/src/test/java/tech/ydb/yoj/databind/schema/naming/TestEntity.java index 04f0e77..6324bbe 100644 --- a/databind/src/test/java/tech/ydb/yoj/databind/schema/naming/TestEntity.java +++ b/databind/src/test/java/tech/ydb/yoj/databind/schema/naming/TestEntity.java @@ -18,13 +18,13 @@ private static class Id { static class SubEntity { boolean boolValue; - @Column(namingStrategy = Column.NamingStrategy.ABSOLUTE) + @Column(columnNaming = Column.ColumnNaming.ABSOLUTE) boolean absoluteBoolValue; @Column(name = "sfe") SingleFieldEntity singleFieldEntity; - @Column(name = "sfe_absolute", namingStrategy = Column.NamingStrategy.ABSOLUTE) + @Column(name = "sfe_absolute", columnNaming = Column.ColumnNaming.ABSOLUTE) SingleFieldEntity singleFieldEntityAbsolute; } }