Code example for Map

Methods: get, remove

0
    @Kroll.method 
    @SuppressWarnings({ "rawtypes", "unchecked" }) 
    public RevisionProxy putProperties(Map properties) {
        this.lastError = null;
 
        String idprop = properties != null ? (String) properties.get("_id") : null;
        if (idprop != null && !idprop.equals(this.docid)) {
            Log.w(LCAT, String.format("Trying to put wrong _id to %s: %s", this, idprop));
        } 
 
        // TODO null properties means delete? 
 
        String prevRevId = null;
        if (properties != null) {
            prevRevId = (String) properties.get("_rev");
            properties.remove("_rev");
        } 
 
        CBLRevision tostore = new CBLRevision(this.docid, null, false);
        tostore.setProperties(properties);
 
        CBLStatus resultStatus = new CBLStatus();
        CBLRevision rev = this.database.putRevision(tostore, prevRevId, false, resultStatus);
        if (rev == null) {
            this.lastError = TitouchdbModule.convertCBLStatusToErrorDict(resultStatus);