예제 #1
0
        public static PointValue FromMap(MapValue map)
        {
            PointBuilder fields = new PointBuilder();

            map.Foreach((key, value) => fields.assign(key.ToLower(), value));
            return(FromInputFields(fields));
        }
            // Recurse through maps and sequences

            public override AnyValue MapMap(MapValue value)
            {
                MapValueBuilder builder = new MapValueBuilder();

                value.Foreach((k, v) => builder.Add(k, v.map(this)));
                return(builder.Build());
            }
예제 #3
0
        public override object MapMap(MapValue value)
        {
            IDictionary <object, object> map = new Dictionary <object, object>();

            value.Foreach((k, v) => map.put(k, v.map(this)));
            return(map);
        }
예제 #4
0
        internal static void FormatMapValue(StringBuilder result, MapValue @params, ICollection <string> obfuscate)
        {
            result.Append('{');
            if (@params != null)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String[] sep = new String[]{""};
                string[] sep = new string[] { "" };
                @params.Foreach((key, value) =>
                {
                    result.Append(sep[0]).Append(key).Append(": ");

                    if (obfuscate.Contains(key))
                    {
                        result.Append("******");
                    }
                    else
                    {
                        result.Append(FormatAnyValue(value));
                    }
                    sep[0] = ", ";
                });
            }
            result.Append("}");
        }
예제 #5
0
        private IDictionary <string, object> AsRawMap(MapValue mapValue, ParameterWriter writer)
        {
            Dictionary <string, object> map = new Dictionary <string, object>();

            mapValue.Foreach((s, value) =>
            {
                value.writeTo(writer);
                map[s] = writer.Value();
            });
            return(map);
        }
예제 #6
0
        private static IDictionary <string, object> ToRawMap(MapValue mapValue)
        {
            Deserializer deserializer       = new Deserializer();
            Dictionary <string, object> map = new Dictionary <string, object>(mapValue.Size());

            mapValue.Foreach((key, value) =>
            {
                value.writeTo(deserializer);
                map[key] = deserializer.Value();
            });

            return(map);
        }
예제 #7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public static java.util.Map<String,Object> readMetaDataMap(org.neo4j.bolt.messaging.Neo4jPack_Unpacker unpacker) throws java.io.IOException
        public static IDictionary <string, object> ReadMetaDataMap(Org.Neo4j.Bolt.messaging.Neo4jPack_Unpacker unpacker)
        {
            MapValue metaDataMapValue                = unpacker.UnpackMap();
            PrimitiveOnlyValueWriter     writer      = new PrimitiveOnlyValueWriter();
            IDictionary <string, object> metaDataMap = new Dictionary <string, object>(metaDataMapValue.Size());

            metaDataMapValue.Foreach((key, value) =>
            {
                object convertedValue = AuthToken.containsSensitiveInformation(key) ? writer.SensitiveValueAsObject(value) : writer.ValueAsObject(value);
                metaDataMap[key]      = convertedValue;
            });
            return(metaDataMap);
        }
예제 #8
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: static java.util.Map<String,Object> parseTransactionMetadata(org.neo4j.values.virtual.MapValue meta) throws org.neo4j.bolt.messaging.BoltIOException
        internal static IDictionary <string, object> ParseTransactionMetadata(MapValue meta)
        {
            AnyValue anyValue = meta.Get(TX_META_DATA_KEY);

            if (anyValue == Values.NO_VALUE)
            {
                return(null);
            }
            else if (anyValue is MapValue)
            {
                MapValue mapValue = ( MapValue )anyValue;
                TransactionMetadataWriter    writer = new TransactionMetadataWriter();
                IDictionary <string, object> txMeta = new Dictionary <string, object>(mapValue.Size());
                mapValue.Foreach((key, value) => txMeta.put(key, writer.ValueAsObject(value)));
                return(txMeta);
            }
            else
            {
                throw new BoltIOException(Org.Neo4j.Kernel.Api.Exceptions.Status_Request.Invalid, "Expecting transaction metadata value to be a Map value, but got: " + anyValue);
            }
        }
예제 #9
0
 private static void AssertMapEqualsWithDelta(MapValue a, MapValue b, double delta)
 {
     assertThat("Map should have same size", a.Size(), equalTo(b.Size()));
     a.Foreach((key, value) =>
     {
         AnyValue aValue = value;
         AnyValue bValue = b.Get(key);
         if (aValue is MapValue)
         {
             assertThat("Value mismatch", bValue is MapValue);
             AssertMapEqualsWithDelta(( MapValue )aValue, ( MapValue )bValue, delta);
         }
         else if (aValue is DoubleValue)
         {
             assertThat("Value mismatch", (( DoubleValue )aValue).doubleValue(), closeTo(((DoubleValue)bValue).doubleValue(), delta));
         }
         else
         {
             assertThat("Value mismatch", aValue, equalTo(bValue));
         }
     });
 }
            // Recurse through maps and sequences

            public override AnyValue MapMap(MapValue value)
            {
                value.Foreach((k, v) => v.map(this));
                return(value);
            }