public static TradeTypeEnum getByCode(String code) { for (TradeTypeEnum type : TradeTypeEnum.values()) { if (type.getCode().equalsIgnoreCase(code)) { return type; } } return null; }