public static SupplierType getType(String code) { if (Materials.getCode().equals(code)) { return Materials; } else if (RealGoods.getCode().equals(code)) { return RealGoods; } else if (Packing.getCode().equals(code)) { return Packing; } else if (Common.getCode().equals(code)) { return Common; } return null; }