コード例 #1
0
 // NOTE: This assumes anyValue is an instance of AnyValue
 public static AnyValue MaterializeAnyValueResult(EmbeddedProxySPI proxySpi, object anyValue)
 {
     if (anyValue is VirtualNodeValue)
     {
         if (anyValue is NodeValue)
         {
             return(( AnyValue )anyValue);
         }
         return(ValueUtils.fromNodeProxy(proxySpi.NewNodeProxy((( VirtualNodeValue )anyValue).id())));
     }
     if (anyValue is VirtualRelationshipValue)
     {
         if (anyValue is RelationshipValue)
         {
             return(( AnyValue )anyValue);
         }
         return(ValueUtils.fromRelationshipProxy(proxySpi.NewRelationshipProxy((( VirtualRelationshipValue )anyValue).id())));
     }
     // If it is a list or map, run it through a ValueMapper that will create proxy objects for entities if needed.
     // This will first do a dry run and return as it is if no conversion is needed.
     // If in the future we will always create proxy objects directly whenever we create values we can skip this
     // Doing this conversion lazily instead, by wrapping with TransformedListValue or TransformedMapValue is probably not a
     // good idea because of the complexities involved (see TOMBSTONE in VirtualValues about why TransformedListValue was killed).
     // NOTE: There is also a case where a ListValue can be storable (ArrayValueListValue) where no conversion is needed
     if ((anyValue is ListValue && !(( ListValue )anyValue).storable()) || anyValue is MapValue)
     {
         return(CompiledMaterializeValueMapper.MapAnyValue(proxySpi, ( AnyValue )anyValue));
     }
     return(( AnyValue )anyValue);
 }
コード例 #2
0
        private void VerifyDoesNotTouchValue(AnyValue value)
        {
            AnyValue mappedValue = CompiledMaterializeValueMapper.MapAnyValue(spi, value);

            assertSame(value, mappedValue);                 // Test with reference equality since we should get the same reference back
        }
コード例 #3
0
        private void VerifyConvertsValue(AnyValue expected, AnyValue valueToTest)
        {
            AnyValue actual = CompiledMaterializeValueMapper.MapAnyValue(spi, valueToTest);

            assertEquals(expected, actual);
        }