Java – Pass Enum as argument to function

November 21, 2020

How to pass Enum parameter to the function

 public enum ModelField {
        CharField,
        ForeignKey,
        Check
 }
public String getForeignKeyField(Column col, Cons.ModelField modelField) {
 return "";
}

You can pass the parameter like this

getForeignKeyField(col, Cons.ModelField.ForeignKey)