Skip to content

New strategy - Conversion methods within the Enum #2

@salvadormarcos

Description

@salvadormarcos

Implementing a new strategy does the conversion using methods declared within Enum. The purpose of this strategy is to provide the flexibility to implement an AttributeConverter but without the additional work of creating an extra class for that task.

Example:

public enum MyEnum {

    // Enum constants and constructor

    public V toDbData() {
        // Convert to the type to be sent to the database.
    }

    public static MyEnum fromDbData(V dbData) {
        // Converts from the value stored in the database to one of the enum constants
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions