Пример #1
0
        public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
        {
            DateTimeOffset value = objectData;
            var            ticks = (value - UnixStart).Ticks;

            return(GraphSONUtil.ToTypedValue("Date", ticks / TimeSpan.TicksPerMillisecond));
        }
Пример #2
0
        public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
        {
            var enumName      = objectData.GetType().Name;
            var valueJavaName = NamingConversions.GetEnumJavaName(enumName, objectData.ToString());

            return(GraphSONUtil.ToTypedValue(enumName, valueJavaName));
        }
Пример #3
0
        public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
        {
            object value = objectData;

            if (StringifyValue)
            {
                value = string.Format(CultureInfo.InvariantCulture, "{0}", value);
            }
            return(GraphSONUtil.ToTypedValue(GraphSONTypeName, value, Prefix));
        }
Пример #4
0
        public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
        {
            object value = objectData;

            if (StringifyValue)
            {
                value = value?.ToString();
            }
            return(GraphSONUtil.ToTypedValue(GraphSONTypeName, value, Prefix));
        }
Пример #5
0
        public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
        {
            Vertex vertex     = objectData;
            var    vertexDict = new Dictionary <string, dynamic>
            {
                { "id", writer.ToDict(vertex.Id) },
                { "label", writer.ToDict(vertex.Label) }
            };

            return(GraphSONUtil.ToTypedValue(nameof(Vertex), vertexDict));
        }
Пример #6
0
        public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
        {
            var binding   = (Binding)objectData;
            var valueDict = new Dictionary <string, object>
            {
                { "value", writer.ToDict(binding.Value) },
                { "key", binding.Key }
            };

            return(GraphSONUtil.ToTypedValue(nameof(Binding), valueDict));
        }
Пример #7
0
        public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
        {
            ILambda lambda    = objectData;
            var     valueDict = new Dictionary <string, dynamic>
            {
                { "script", lambda.LambdaExpression },
                { "language", lambda.Language },
                { "arguments", lambda.Arguments }
            };

            return(GraphSONUtil.ToTypedValue(nameof(Lambda), valueDict));
        }
Пример #8
0
        public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
        {
            Property property    = objectData;
            var      elementDict = CreateElementDict(property.Element, writer);
            var      valueDict   = new Dictionary <string, dynamic>
            {
                { "key", property.Key },
                { "value", writer.ToDict(property.Value) },
                { "element", elementDict }
            };

            return(GraphSONUtil.ToTypedValue(nameof(Property), valueDict));
        }
Пример #9
0
        public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
        {
            VertexProperty vertexProperty = objectData;
            var            valueDict      = new Dictionary <string, dynamic>
            {
                { "id", writer.ToDict(vertexProperty.Id) },
                { "label", vertexProperty.Label },
                { "value", writer.ToDict(vertexProperty.Value) },
                { "vertex", writer.ToDict(vertexProperty.Vertex.Id) }
            };

            return(GraphSONUtil.ToTypedValue(nameof(VertexProperty), valueDict));
        }
Пример #10
0
        public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
        {
            Edge edge     = objectData;
            var  edgeDict = new Dictionary <string, dynamic>
            {
                { "id", writer.ToDict(edge.Id) },
                { "outV", writer.ToDict(edge.OutV.Id) },
                { "outVLabel", edge.OutV.Label },
                { "label", edge.Label },
                { "inV", writer.ToDict(edge.InV.Id) },
                { "inVLabel", edge.InV.Label }
            };

            return(GraphSONUtil.ToTypedValue(nameof(Edge), edgeDict));
        }
Пример #11
0
        public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
        {
            if (!(objectData is IDictionary map))
            {
                throw new InvalidOperationException("Object must implement IDictionary");
            }
            var result = new object[map.Count * 2];
            var index  = 0;

            foreach (var key in map.Keys)
            {
                result[index++] = writer.ToDict(key);
                result[index++] = writer.ToDict(map[key]);
            }
            return(GraphSONUtil.ToTypedValue("Map", result));
        }
Пример #12
0
        public Dictionary <string, dynamic> Dictify(dynamic predicate, GraphSONWriter writer)
        {
            TraversalPredicate p = predicate;
            var value            = p.Other == null
                ? writer.ToDict(p.Value)
                : new List <dynamic>
            {
                writer.ToDict(p.Value), writer.ToDict(p.Other)
            };
            var dict = new Dictionary <string, dynamic>
            {
                { "predicate", p.OperatorName },
                { "value", value }
            };

            return(GraphSONUtil.ToTypedValue("P", dict));
        }
Пример #13
0
        public Dictionary <string, dynamic> Dictify(dynamic bytecodeObj, GraphSONWriter writer)
        {
            Bytecode bytecode = bytecodeObj;

            var valueDict = new Dictionary <string, IEnumerable <IEnumerable <dynamic> > >();

            if (bytecode.SourceInstructions.Count > 0)
            {
                valueDict["source"] = DictifyInstructions(bytecode.SourceInstructions, writer);
            }
            if (bytecode.StepInstructions.Count > 0)
            {
                valueDict["step"] = DictifyInstructions(bytecode.StepInstructions, writer);
            }

            return(GraphSONUtil.ToTypedValue(nameof(Bytecode), valueDict));
        }
Пример #14
0
        public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
        {
            DateTime dateTime = objectData;

            return(GraphSONUtil.ToTypedValue("Date", ToJavaTimestamp(dateTime)));
        }
Пример #15
0
 public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
 {
     return(GraphSONUtil.ToTypedValue(GraphSONTypeName, objectData));
 }
Пример #16
0
        public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
        {
            Guid guid = objectData;

            return(GraphSONUtil.ToTypedValue("UUID", guid));
        }
Пример #17
0
        public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
        {
            AbstractTraversalStrategy strategy = objectData;

            return(GraphSONUtil.ToTypedValue(strategy.StrategyName, writer.ToDict(strategy.Configuration)));
        }
Пример #18
0
        public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
        {
            DateTimeOffset value = objectData;

            return(GraphSONUtil.ToTypedValue("Date", value.ToUnixTimeMilliseconds()));
        }
Пример #19
0
        public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
        {
            EnumWrapper enumToSerialize = objectData;

            return(GraphSONUtil.ToTypedValue(enumToSerialize.EnumName, enumToSerialize.EnumValue));
        }
Пример #20
0
 public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
 {
     byte[] value = objectData;
     return(GraphSONUtil.ToTypedValue("ByteBuffer", Convert.ToBase64String(value), "gx"));
 }
Пример #21
0
        public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
        {
            BigInteger value = objectData;

            return(GraphSONUtil.ToTypedValue("BigInteger", value.ToString(), "gx"));
        }
Пример #22
0
        public Dictionary <string, dynamic> Dictify(dynamic objectData, GraphSONWriter writer)
        {
            TimeSpan value = objectData;

            return(GraphSONUtil.ToTypedValue("Duration", XmlConvert.ToString(value), "gx"));
        }