Beispiel #1
0
        protected internal override void Serialize(MappingSerializer serializer)
        {
            foreach (object key in _value.Keys)
            {
                object val       = _value[key];
                string keyString = key == null ? "null" : key.ToString();
                if (val is Number)
                {
                    serializer.PutNumber(keyString, ( Number )val);
                }
                else if (val is bool?)
                {
                    serializer.PutBoolean(keyString, ( bool? )val.Value);
                }
                else if (val is string)
                {
                    serializer.PutString(keyString, ( string )val);
                }
                else if (val is Path)
                {
                    PathRepresentation <Path> representation = new PathRepresentation <Path>(( Path )val);
                    serializer.PutMapping(keyString, representation);
                }
                else if (val is System.Collections.IEnumerable)
                {
                    serializer.PutList(keyString, ObjectToRepresentationConverter.GetListRepresentation((System.Collections.IEnumerable)val));
                }
                else if (val is System.Collections.IDictionary)
                {
                    serializer.PutMapping(keyString, ObjectToRepresentationConverter.GetMapRepresentation((System.Collections.IDictionary)val));
                }
                else if (val == null)
                {
                    serializer.PutString(keyString, null);
                }
                else if (val.GetType().IsArray)
                {
                    object[] objects = ToArray(val);

                    serializer.PutList(keyString, ObjectToRepresentationConverter.GetListRepresentation(asList(objects)));
                }
                else if (val is Node || val is Relationship)
                {
                    Representation representation = ObjectToRepresentationConverter.GetSingleRepresentation(val);
                    serializer.PutMapping(keyString, ( MappingRepresentation )representation);
                }
                else
                {
                    throw new System.ArgumentException("Unsupported value type: " + val.GetType());
                }
            }
        }
Beispiel #2
0
 public IterableWrapperAnonymousInnerClass(PathRepresentation <P> outerInstance, IEnumerable <Node> nodes) : base(nodes)
 {
     this.outerInstance = outerInstance;
 }
Beispiel #3
0
 public IterableWrapperAnonymousInnerClass2(PathRepresentation <P> outerInstance, IEnumerable <Relationship> relationships) : base(relationships)
 {
     this.outerInstance = outerInstance;
 }
Beispiel #4
0
 public IterableWrapperAnonymousInnerClass3(PathRepresentation <P> outerInstance, List <string> directionStrings) : base(directionStrings)
 {
     this.outerInstance = outerInstance;
 }