Если вы хотите конкретно класс:
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class Category {
public static final Category FIRST = new Category(1, "MyCategory1", "someField");
public static final Category SECOND = new Category(2, "MyCategory2", "someField");
public static final Category THIRD = new Category(3, "MyCategory3", "someField");
private int categoryId;
private String category;
private String someField;
public String doIt() {
return this.categoryId +": " + this.someField;
}
}
А затем просто используйте константы:
public class TestCategory {
public static void main(String[] args) {
System.out.println(FIRST.doIt());
System.out.println(FIRST.getCategory());
}
}