public void checkKeyType(Key key) { try { userKeyFieldMapper.converter.fromProperty(key.userKey.getObject()); } catch (ClassCastException e) { throw new SpikeifyError("Mismatched key type: provided " + key.userKey.getObject().getClass().getName() + " key can not be mapped to " + userKeyFieldMapper.field.getType() + " (" + userKeyFieldMapper.field.getDeclaringClass().getName() + "." + userKeyFieldMapper.field.getName() + ")"); } }
private <T> T getIdValue(Key key, Map<String, Object> data, AerospikePersistentProperty property) { Value userKey = key.userKey; Object value = userKey == null ? data.get(USER_KEY) : userKey.getObject(); Assert.notNull(value, "Id must not be null!"); return (T) convertIfNeeded(value, property.getType()); }
public boolean validate(Record record) { if (bins == null) { if (record == null) { return true; } System.out.println("Mismatch: Expected null. Received not null."); return false; } if (record == null || record.bins == null) { System.out.println("Mismatch: Expected not null. Received null."); return false; } Map<String,Object> map = record.bins; int max = bins.length; for (int i = 0; i < max; i++) { Object expected = bins[i].value.getObject(); Object received = map.get(Integer.toString(i)); if (! expected.equals(received)) { System.out.println("Mismatch: Expected '" + expected + "' Received '" + received + "'"); return false; } } return true; } }
public void add(Bin[] addBins, int incrValue) { int orig = 0; if (this.bins != null) { Bin bin = this.bins[0]; if (bin != null) { Object object = bin.value.getObject(); if (object instanceof Integer) { orig = (Integer)object; } } } if (orig != 0) { this.bins[0] = new Bin(addBins[0].name, orig + incrValue); } else { this.bins = addBins; } this.generation++; }
Object obj = newBin.value.getObject();
/** * {@inheritDoc} * * @return true if more elements exist * @throws IOException if we reach non-existent result */ @Override protected boolean nextInner() throws IOException { if (offset < 0 || offset > (resultRecords.size() - 1)) { return false; } key = (K) resultRecords.get((int) this.offset).getKey().userKey.getObject(); persistent = (T) getDataStore() .createPersistentInstance(resultRecords.get((int) this.offset).getRecord(), fields); return true; } }
/** * {@inheritDoc} * * @return true if more elements exist * @throws IOException if we reach non-existent result */ @Override protected boolean nextInner() throws IOException { if (offset < 0 || offset > (resultRecords.size() - 1)) { return false; } key = (K) resultRecords.get((int) this.offset).getKey().userKey.getObject(); persistent = (T) getDataStore() .createPersistentInstance(resultRecords.get((int) this.offset).getRecord(), fields); return true; }
if(valType != ParticleType.LIST) throw new IllegalArgumentException("FilterOperation.IN expects List argument with type: " + ParticleType.LIST + ", but got: " + valType); List<?> inList = (List<?>) val.getObject(); for(Object value : inList) rs.addAll(new Qualifier(this.getField(), FilterOperation.EQ, Value.get(value)).toPredExp()); rs.add(PredExp.or(inList.size()));
Object userkey = key.userKey.getObject(); Record record = rs.getRecord(); int result = record.getInt(binName);