@SuppressWarnings("unchecked") @Override protected StreamingPropertyValue loadStreamingPropertyValue(StreamingPropertyValueRef<?> streamingPropertyValueRef, long timestamp) { return ((StreamingPropertyValueRef<SqlGraph>) streamingPropertyValueRef).toStreamingPropertyValue(graph, timestamp); } }
protected Class<?> getValueType(Object value) { Class<?> valueClass = value.getClass(); if (value instanceof StreamingPropertyValue) { valueClass = ((StreamingPropertyValue) value).getValueType(); } else if (value instanceof StreamingPropertyValueRef) { valueClass = ((StreamingPropertyValueRef) value).getValueType(); } return valueClass; }
@Test public void testStreamingPropertyValueRef() { StreamingPropertyValue spv = new DefaultStreamingPropertyValue(new ByteArrayInputStream("test".getBytes()), byte[].class, 4L) .searchIndex(true); StreamingPropertyValueRef streamingPropertyValueRef = new TestStreamingPropertyValueRef(spv); testValue( streamingPropertyValueRef, getStreamingPropertyValueRefBytes(), (givenValue, deserializedValue) -> { assertNotNull(deserializedValue); assertTrue(deserializedValue.isSearchIndex()); assertEquals(byte[].class, deserializedValue.getValueType()); } ); }
@Test public void testStreamingPropertyValueRef() { StreamingPropertyValue spv = new DefaultStreamingPropertyValue(new ByteArrayInputStream("test".getBytes()), byte[].class, 4L) .searchIndex(true); StreamingPropertyValueRef streamingPropertyValueRef = new TestStreamingPropertyValueRef(spv); testValue( streamingPropertyValueRef, getStreamingPropertyValueRefBytes(), (givenValue, deserializedValue) -> { assertNotNull(deserializedValue); assertTrue(deserializedValue.isSearchIndex()); assertEquals(byte[].class, deserializedValue.getValueType()); } ); }
protected StreamingPropertyValue loadStreamingPropertyValue(StreamingPropertyValueRef<?> streamingPropertyValueRef, long timestamp) { // There's no need to have a Graph object for the pure in-memory implementation. Subclasses should override. return streamingPropertyValueRef.toStreamingPropertyValue(null, timestamp); }
protected Class<?> getValueType(Object value) { Class<?> valueClass = value.getClass(); if (value instanceof StreamingPropertyValue) { valueClass = ((StreamingPropertyValue) value).getValueType(); } else if (value instanceof StreamingPropertyValueRef) { valueClass = ((StreamingPropertyValueRef) value).getValueType(); } return valueClass; }
@Override public Object getValue() { if (cachedPropertyValue == null) { if (propertyValue == null || propertyValue.length == 0) { return null; } cachedPropertyValue = this.vertexiumSerializer.bytesToObject(propertyValue); if (cachedPropertyValue instanceof StreamingPropertyValueRef) { //noinspection unchecked cachedPropertyValue = ((StreamingPropertyValueRef) cachedPropertyValue).toStreamingPropertyValue(this.graph, getTimestamp()); } } return cachedPropertyValue; }
@Override public Object getValue() { if (cachedPropertyValue == null) { if (propertyValue == null || propertyValue.length == 0) { return null; } cachedPropertyValue = this.vertexiumSerializer.bytesToObject(propertyValue); if (cachedPropertyValue instanceof StreamingPropertyValueRef) { //noinspection unchecked cachedPropertyValue = ((StreamingPropertyValueRef) cachedPropertyValue).toStreamingPropertyValue(this.graph, getTimestamp()); } } return cachedPropertyValue; }
@Override @SuppressWarnings("unchecked") protected StreamingPropertyValueRef saveStreamingPropertyValue(String rowKey, Property property, StreamingPropertyValue propertyValue) { StreamingPropertyValueRef streamingPropertyValueRef = super.saveStreamingPropertyValue(rowKey, property, propertyValue); ((MutableProperty) property).setValue(streamingPropertyValueRef.toStreamingPropertyValue(AccumuloGraph.this, property.getTimestamp())); return streamingPropertyValueRef; } };
@Override @SuppressWarnings("unchecked") protected StreamingPropertyValueRef saveStreamingPropertyValue(String rowKey, Property property, StreamingPropertyValue propertyValue) { StreamingPropertyValueRef streamingPropertyValueRef = super.saveStreamingPropertyValue(rowKey, property, propertyValue); ((MutableProperty) property).setValue(streamingPropertyValueRef.toStreamingPropertyValue(AccumuloGraph.this, property.getTimestamp())); return streamingPropertyValueRef; } };
value = ((StreamingPropertyValueRef) value).toStreamingPropertyValue(this, timestamp);
value = ((StreamingPropertyValueRef) value).toStreamingPropertyValue(this, timestamp);