使用循环或NSPredicate删除对象(JSON - Objective-C)

时间:2016-04-01 08:25:07

标签: objective-c json object

我的json我有一个名为drawDate的键,如果日期是否定的,我会删除带有“for”循环的对象然后使用NSPredicate,就像我为“状态”所做的那样,怎么办?谢谢

(我不使用NSObject类)

我的代码:

@CrossOrigin(maxAge = 3600)
@RestController
@RequestMapping("dashboard")
public class SyncronizedMobileDataFlowController {

    private SimpMessagingTemplate template;
    // registery map for listener url's: key(msisdn), value(listener url)
    private Map<String, RegisteryObject> listenerRegistery;

    @Autowired
    private PnDao dao;

    @Autowired
    public SyncronizedMobileDataFlowController(SimpMessagingTemplate template) {
        this.template = template;
        this.listenerRegistery = new HashMap<String, RegisteryObject>();
    }

    @CrossOrigin(exposedHeaders="X-VLX-Authorized,X-VLX-LoginUrl",allowCredentials="true")
    @RequestMapping(value = "/register", method = RequestMethod.POST)
    @ResponseStatus(HttpStatus.OK)
    public RegisterResponse register(@RequestBody RegisteryRequest registeryRequest) {

        if (dao.sendRealTimeDataDemandNotification(registeryRequest.getDeviceId(), registeryRequest.getDuration(),
                registeryRequest.getAppId())) {
            this.listenerRegistery.put(registeryRequest.getDeviceId(),
                    new RegisteryObject("topic/mobiledata/" + registeryRequest.getDeviceId(),
                            System.currentTimeMillis() + registeryRequest.getDuration()));
            return new RegisterResponse("Success");
        } else {
            return new RegisterResponse("Error in process, please try again");
        }

    }
}

0 个答案:

没有答案