Class ColumnProcessor
java.lang.Object
dimstyl.orm.internal.processors.ColumnProcessor
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePrivate constructor to prevent instantiation. -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringdetermineColumnName(Column column, String fieldName) Determines the column name based on theColumnannotation.extractColumnAnnotation(Field field) Extracts theColumnannotation from the given field, if present.(package private) static Optional<ColumnMetadata> extractMetadata(Field field, DatabaseEngine databaseEngine) Extracts metadata from a given field and constructs aColumnMetadataobject.(package private) static booleanisPrimaryKey(Field field) Checks whether the given field is annotated as a primary key.(package private) static StringresolveColumnName(Field field) Resolves the column name for a given field.
-
Constructor Details
-
ColumnProcessor
private ColumnProcessor()Private constructor to prevent instantiation.
-
-
Method Details
-
extractMetadata
static Optional<ColumnMetadata> extractMetadata(Field field, DatabaseEngine databaseEngine) throws UnsupportedFieldTypeException Extracts metadata from a given field and constructs aColumnMetadataobject.If the field is not annotated with
Column, an emptyOptionalis returned. Otherwise, column properties such as name, type, primary key status, nullability, and uniqueness are extracted.- Parameters:
field- The field to process.databaseEngine- TheDatabaseEnginefor which the column type should be resolved.- Returns:
- An
Optionalcontaining theColumnMetadataif the field is annotated, otherwise an emptyOptional. - Throws:
UnsupportedFieldTypeException- If the field type is not supported by the ORM framework.
-
isPrimaryKey
Checks whether the given field is annotated as a primary key.- Parameters:
field- The field to check.- Returns:
trueif the field is annotated withPrimaryKey, otherwisefalse.
-
resolveColumnName
Resolves the column name for a given field.If the field is annotated with
Column, its specified name is used. Otherwise, an exception is thrown if the annotation is missing.- Parameters:
field- The field whose column name needs to be resolved.- Returns:
- The resolved column name.
- Throws:
MissingColumnAnnotationException- If the field is not annotated withColumn.
-
determineColumnName
Determines the column name based on theColumnannotation.If the annotation specifies a column name, it is returned. Otherwise, a default name is derived from the field name using
StringUtils.getDefaultName(String).- Parameters:
column- TheColumnannotation instance.fieldName- The name of the field.- Returns:
- The resolved column name.
-
extractColumnAnnotation
-