jeudi 5 septembre 2019

is it bad design to add long methods in a Enum?

I have a Enum in which I want to add a logic to calculate value. this method is getting long. Want to know whether this is a good design or bad? Please see code snippet below:

public enum TestEnum{

    Value01(
            null,
            true,
            "Value",
            Utils.SMALLER_OR_EQUAL_TO_ZERO),

    Value02(
            null,
            false,
            "value2",
            Utils.BIGGER_THAN_ZERO),

    Value03(
            null,
            false,
            "value4",
            Utils.BIGGER_THAN_ZERO);

}
//Long method
public static TestEnum getValues(.....){

        if (Condition 1) {
           // some line of code
        }
        if (Condition 2) {
            // some lines of code
        } else {
            // // some lines of code
        }
        return values;
    }

Aucun commentaire:

Enregistrer un commentaire