From 2039a29d918481f75274dfbdf843edaf60ca5349 Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Sun, 27 Apr 2014 15:05:22 +1200 Subject: [PATCH] -Rename SpecialPropertyHandling to MetadataPropertyHandling --- .../Converters/XmlNodeConverterTest.cs | 2 +- .../Newtonsoft.Json.Tests.Net20.csproj | 2 +- .../Newtonsoft.Json.Tests.Net35.csproj | 2 +- .../Newtonsoft.Json.Tests.Net40.csproj | 2 +- .../Newtonsoft.Json.Tests.Portable.csproj | 2 +- .../Newtonsoft.Json.Tests.Portable40.csproj | 2 +- .../Newtonsoft.Json.Tests.WinRT.csproj | 2 +- .../Newtonsoft.Json.Tests.csproj | 2 +- .../Properties/AssemblyInfo.cs | 2 +- .../Serialization/JsonSerializerTest.cs | 4 +-- ...ts.cs => MetadataPropertyHandlingTests.cs} | 22 +++++++------- .../PreserveReferencesHandlingTests.cs | 4 +-- .../SerializationErrorHandlingTests.cs | 10 +++---- .../Serialization/TraceWriterTests.cs | 6 ++-- .../Serialization/TypeNameHandlingTests.cs | 2 +- Src/Newtonsoft.Json/JsonSerializer.cs | 20 ++++++------- Src/Newtonsoft.Json/JsonSerializerSettings.cs | 14 ++++----- ...andling.cs => MetadataPropertyHandling.cs} | 8 ++--- .../Newtonsoft.Json.Net20.csproj | 2 +- .../Newtonsoft.Json.Net35.csproj | 2 +- .../Newtonsoft.Json.Net40.csproj | 2 +- .../Newtonsoft.Json.Portable.csproj | 2 +- .../Newtonsoft.Json.Portable40.csproj | 2 +- .../Newtonsoft.Json.WinRT.csproj | 2 +- Src/Newtonsoft.Json/Newtonsoft.Json.csproj | 2 +- .../Properties/AssemblyInfo.cs | 2 +- .../JsonSerializerInternalReader.cs | 29 +++++++++---------- .../Serialization/JsonSerializerProxy.cs | 6 ++-- 28 files changed, 79 insertions(+), 80 deletions(-) rename Src/Newtonsoft.Json.Tests/Serialization/{SpecialPropertyHandlingTests.cs => MetadataPropertyHandlingTests.cs} (93%) rename Src/Newtonsoft.Json/{SpecialPropertyHandling.cs => MetadataPropertyHandling.cs} (81%) diff --git a/Src/Newtonsoft.Json.Tests/Converters/XmlNodeConverterTest.cs b/Src/Newtonsoft.Json.Tests/Converters/XmlNodeConverterTest.cs index 21e97b503..2e06b80c7 100644 --- a/Src/Newtonsoft.Json.Tests/Converters/XmlNodeConverterTest.cs +++ b/Src/Newtonsoft.Json.Tests/Converters/XmlNodeConverterTest.cs @@ -1214,7 +1214,7 @@ public void DeserializeExample() } [Test] - public void SerializeDeserializeSpecialProperties() + public void SerializeDeserializeMetadataProperties() { PreserveReferencesHandlingTests.CircularDictionary circularDictionary = new PreserveReferencesHandlingTests.CircularDictionary(); circularDictionary.Add("other", new PreserveReferencesHandlingTests.CircularDictionary { { "blah", null } }); diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj index dbe0165e6..b2666c95a 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net20.csproj @@ -103,10 +103,10 @@ + - diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net35.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net35.csproj index 760b968e1..9048f3c59 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net35.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net35.csproj @@ -145,10 +145,10 @@ + - diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net40.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net40.csproj index f1e9baa41..61beec6ec 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net40.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Net40.csproj @@ -266,9 +266,9 @@ + - diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable.csproj index 500ef5b2f..d27802e79 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable.csproj @@ -149,9 +149,9 @@ + - diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable40.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable40.csproj index 76808865e..ed6010110 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable40.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Portable40.csproj @@ -146,9 +146,9 @@ + - diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WinRT.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WinRT.csproj index b945a3cee..03568accb 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WinRT.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.WinRT.csproj @@ -180,7 +180,7 @@ - + diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj index 11807c0dd..e821e170d 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj @@ -242,6 +242,7 @@ + @@ -251,7 +252,6 @@ - diff --git a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs index 5cd90735c..3720bc87e 100644 --- a/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs +++ b/Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs @@ -75,4 +75,4 @@ // by using the '*' as shown below: [assembly: AssemblyVersion("6.0.0.0")] -[assembly: AssemblyFileVersion("6.0.2.17226")] +[assembly: AssemblyFileVersion("6.0.3.17227")] diff --git a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs index 1a334579f..b22f2b149 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs @@ -3407,7 +3407,7 @@ public void DeserializeDictionaryWithNoDefaultConstructor_PreserveReferences() () => JsonConvert.DeserializeObject(json, new JsonSerializerSettings { PreserveReferencesHandling = PreserveReferencesHandling.All, - SpecialPropertyHandling = SpecialPropertyHandling.Default + MetadataPropertyHandling = MetadataPropertyHandling.Default })); } @@ -4978,7 +4978,7 @@ public void DeserializeMinValueDecimal() { var data = new DecimalTest(decimal.MinValue); var json = JsonConvert.SerializeObject(data); - var obj = JsonConvert.DeserializeObject(json, new JsonSerializerSettings { SpecialPropertyHandling = SpecialPropertyHandling.Default }); + var obj = JsonConvert.DeserializeObject(json, new JsonSerializerSettings { MetadataPropertyHandling = MetadataPropertyHandling.Default }); Assert.AreEqual(decimal.MinValue, obj.Value); } diff --git a/Src/Newtonsoft.Json.Tests/Serialization/SpecialPropertyHandlingTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/MetadataPropertyHandlingTests.cs similarity index 93% rename from Src/Newtonsoft.Json.Tests/Serialization/SpecialPropertyHandlingTests.cs rename to Src/Newtonsoft.Json.Tests/Serialization/MetadataPropertyHandlingTests.cs index 9282ddc9d..2d752955b 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/SpecialPropertyHandlingTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/MetadataPropertyHandlingTests.cs @@ -41,7 +41,7 @@ namespace Newtonsoft.Json.Tests.Serialization { [TestFixture] - public class SpecialPropertyHandlingTests : TestFixtureBase + public class MetadataPropertyHandlingTests : TestFixtureBase { [Test] public void DeserializeArraysWithPreserveObjectReferences() @@ -80,7 +80,7 @@ public void DeserializeArraysWithPreserveObjectReferences() new JsonSerializerSettings { PreserveReferencesHandling = PreserveReferencesHandling.All, - SpecialPropertyHandling = SpecialPropertyHandling.ReadAhead + MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead }); }); } @@ -99,7 +99,7 @@ public void SerializeDeserialize_DictionaryContextContainsGuid_DeserializesItemA { Formatting = Formatting.Indented, TypeNameHandling = TypeNameHandling.All, - SpecialPropertyHandling = SpecialPropertyHandling.ReadAhead + MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead }; string serializedString = JsonConvert.SerializeObject(inputContext, jsonSerializerSettings); @@ -140,7 +140,7 @@ public void DeserializeGuid() Item actual = JsonConvert.DeserializeObject(jsonString, new JsonSerializerSettings { - SpecialPropertyHandling = SpecialPropertyHandling.ReadAhead + MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead }); Assert.AreEqual(new Guid("d8220a4b-75b1-4b7a-8112-b7bdae956a45"), actual.SourceTypeID); @@ -182,7 +182,7 @@ public void DeserializeListsWithPreserveObjectReferences() new JsonSerializerSettings { PreserveReferencesHandling = PreserveReferencesHandling.All, - SpecialPropertyHandling = SpecialPropertyHandling.ReadAhead + MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead }); Assert.AreEqual(3, circularList.Count); @@ -210,7 +210,7 @@ public void DeserializeTypeNameOnly() JsonConvert.DeserializeObject(json, null, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Objects, - SpecialPropertyHandling = SpecialPropertyHandling.ReadAhead + MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead }); }); } @@ -234,7 +234,7 @@ public void SerializeRefNull() Dictionary result = JsonConvert.DeserializeObject>(json, new JsonSerializerSettings { - SpecialPropertyHandling = SpecialPropertyHandling.ReadAhead + MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead }); Assert.AreEqual(3, result.Count); @@ -262,7 +262,7 @@ public void DeserializeEmployeeReference() List employees = JsonConvert.DeserializeObject>(json, new JsonSerializerSettings { - SpecialPropertyHandling = SpecialPropertyHandling.ReadAhead + MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead }); Assert.AreEqual(2, employees.Count); @@ -294,7 +294,7 @@ public void DeserializeFromJToken() List employees = t1.ToObject>(JsonSerializer.Create(new JsonSerializerSettings { - SpecialPropertyHandling = SpecialPropertyHandling.ReadAhead + MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead })); Assert.AreEqual(2, employees.Count); @@ -338,7 +338,7 @@ public void DeserializeGenericObjectListWithTypeName() { TypeNameHandling = TypeNameHandling.Objects, TypeNameAssemblyFormat = FormatterAssemblyStyle.Full, - SpecialPropertyHandling = SpecialPropertyHandling.ReadAhead + MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead }); Assert.AreEqual(4, values.Count); @@ -386,7 +386,7 @@ public void WriteListTypeNameForProperty() TypeNameHandlingTests.TypeNameProperty deserialized = JsonConvert.DeserializeObject(json, new JsonSerializerSettings { - SpecialPropertyHandling = SpecialPropertyHandling.ReadAhead + MetadataPropertyHandling = MetadataPropertyHandling.ReadAhead }); Assert.AreEqual("Name!", deserialized.Name); CustomAssert.IsInstanceOfType(typeof(List), deserialized.Value); diff --git a/Src/Newtonsoft.Json.Tests/Serialization/PreserveReferencesHandlingTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/PreserveReferencesHandlingTests.cs index 456e4a5f6..35e5e9d73 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/PreserveReferencesHandlingTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/PreserveReferencesHandlingTests.cs @@ -298,7 +298,7 @@ public void UnexpectedEnd() new JsonSerializerSettings { PreserveReferencesHandling = PreserveReferencesHandling.All, - SpecialPropertyHandling = SpecialPropertyHandling.Default + MetadataPropertyHandling = MetadataPropertyHandling.Default }); }); } @@ -1069,7 +1069,7 @@ public void DuplicateId() "Error reading object reference '1'. Path 'Data.Prop2.MyProperty', line 9, position 20.", () => JsonConvert.DeserializeObject(json, new JsonSerializerSettings { - SpecialPropertyHandling = SpecialPropertyHandling.Default + MetadataPropertyHandling = MetadataPropertyHandling.Default })); } } diff --git a/Src/Newtonsoft.Json.Tests/Serialization/SerializationErrorHandlingTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/SerializationErrorHandlingTests.cs index 32518990c..db328fd4a 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/SerializationErrorHandlingTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/SerializationErrorHandlingTests.cs @@ -407,7 +407,7 @@ public void MultipleRequiredPropertyErrors() string json = "{}"; List errors = new List(); JsonSerializer serializer = new JsonSerializer(); - serializer.SpecialPropertyHandling = SpecialPropertyHandling.Default; + serializer.MetadataPropertyHandling = MetadataPropertyHandling.Default; serializer.Error += delegate(object sender, ErrorEventArgs args) { errors.Add(args.ErrorContext.Path + " - " + args.ErrorContext.Member + " - " + args.ErrorContext.Error.Message); @@ -540,7 +540,7 @@ public void InfiniteLoopArrayHandlingInObject() "{'badarray':[0,x,2],'goodarray':[0,1,2]}", new JsonSerializerSettings { - SpecialPropertyHandling = SpecialPropertyHandling.Default, + MetadataPropertyHandling = MetadataPropertyHandling.Default, Error = (sender, arg) => { errors.Add(arg.ErrorContext.Error.Message); @@ -570,7 +570,7 @@ public void ErrorHandlingEndOfContent() JsonSerializer jsonSerializer = JsonSerializer.Create(new JsonSerializerSettings { MaxDepth = maxDepth, - SpecialPropertyHandling = SpecialPropertyHandling.Default + MetadataPropertyHandling = MetadataPropertyHandling.Default }); jsonSerializer.Error += (sender, e) => { @@ -601,7 +601,7 @@ public void ErrorHandlingEndOfContentDictionary() const int maxDepth = 256; using (var jsonTextReader = new JsonTextReader(new StringReader(input)) { MaxDepth = maxDepth }) { - JsonSerializer jsonSerializer = JsonSerializer.Create(new JsonSerializerSettings { MaxDepth = maxDepth, SpecialPropertyHandling = SpecialPropertyHandling.Default }); + JsonSerializer jsonSerializer = JsonSerializer.Create(new JsonSerializerSettings { MaxDepth = maxDepth, MetadataPropertyHandling = MetadataPropertyHandling.Default }); jsonSerializer.Error += (sender, e) => { errors.Add(e.ErrorContext.Error.Message); @@ -641,7 +641,7 @@ public void ErrorHandlingEndOfContentDynamic() errors.Add(e.ErrorContext.Error.Message); e.ErrorContext.Handled = true; }, - SpecialPropertyHandling = SpecialPropertyHandling.Default + MetadataPropertyHandling = MetadataPropertyHandling.Default }); Assert.AreEqual(true, newDynamicObject.Explicit); diff --git a/Src/Newtonsoft.Json.Tests/Serialization/TraceWriterTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/TraceWriterTests.cs index eea5d8f55..f8bf157f5 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/TraceWriterTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/TraceWriterTests.cs @@ -140,7 +140,7 @@ public void MemoryTraceWriterDeserializeTest() { TraceWriter = traceWriter, Converters = { new JavaScriptDateTimeConverter() }, - SpecialPropertyHandling = SpecialPropertyHandling.Default + MetadataPropertyHandling = MetadataPropertyHandling.Default }); Console.WriteLine(traceWriter); @@ -403,7 +403,7 @@ public void DeserializeDictionarysWithPreserveObjectReferences() new JsonSerializerSettings { PreserveReferencesHandling = PreserveReferencesHandling.All, - SpecialPropertyHandling = SpecialPropertyHandling.Default, + MetadataPropertyHandling = MetadataPropertyHandling.Default, TraceWriter = traceWriter }); @@ -523,7 +523,7 @@ public void DeserializeTypeName() JsonConvert.DeserializeObject(json, null, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All, - SpecialPropertyHandling = SpecialPropertyHandling.Default, + MetadataPropertyHandling = MetadataPropertyHandling.Default, TraceWriter = traceWriter }); diff --git a/Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs b/Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs index f88f26fca..c27d07041 100644 --- a/Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs +++ b/Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs @@ -122,7 +122,7 @@ public void NestedValueObjects() { var reader = new JsonTextReader(new StringReader(sb.ToString())); var ser = new JsonSerializer(); - ser.SpecialPropertyHandling = SpecialPropertyHandling.Default; + ser.MetadataPropertyHandling = MetadataPropertyHandling.Default; ser.Deserialize(reader); }); } diff --git a/Src/Newtonsoft.Json/JsonSerializer.cs b/Src/Newtonsoft.Json/JsonSerializer.cs index 5d299ebc2..c096595d0 100644 --- a/Src/Newtonsoft.Json/JsonSerializer.cs +++ b/Src/Newtonsoft.Json/JsonSerializer.cs @@ -53,7 +53,7 @@ public class JsonSerializer internal NullValueHandling _nullValueHandling; internal DefaultValueHandling _defaultValueHandling; internal ConstructorHandling _constructorHandling; - internal SpecialPropertyHandling _specialPropertyHandling; + internal MetadataPropertyHandling _metadataPropertyHandling; internal JsonConverterCollection _converters; internal IContractResolver _contractResolver; internal ITraceWriter _traceWriter; @@ -259,18 +259,18 @@ public virtual ConstructorHandling ConstructorHandling } /// - /// Gets or sets how special properties are used during deserialization. + /// Gets or sets how metadata properties are used during deserialization. /// - /// The special properties handling. - public virtual SpecialPropertyHandling SpecialPropertyHandling + /// The metadata properties handling. + public virtual MetadataPropertyHandling MetadataPropertyHandling { - get { return _specialPropertyHandling; } + get { return _metadataPropertyHandling; } set { - if (value < SpecialPropertyHandling.Default || value > SpecialPropertyHandling.ReadAhead) + if (value < MetadataPropertyHandling.Default || value > MetadataPropertyHandling.ReadAhead) throw new ArgumentOutOfRangeException("value"); - _specialPropertyHandling = value; + _metadataPropertyHandling = value; } } @@ -443,7 +443,7 @@ public JsonSerializer() _preserveReferencesHandling = JsonSerializerSettings.DefaultPreserveReferencesHandling; _constructorHandling = JsonSerializerSettings.DefaultConstructorHandling; _typeNameHandling = JsonSerializerSettings.DefaultTypeNameHandling; - _specialPropertyHandling = JsonSerializerSettings.DefaultSpecialPropertyHandling; + _metadataPropertyHandling = JsonSerializerSettings.DefaultMetadataPropertyHandling; _context = JsonSerializerSettings.DefaultContext; _binder = DefaultSerializationBinder.Instance; @@ -533,8 +533,8 @@ private static void ApplySerializerSettings(JsonSerializer serializer, JsonSeria // serializer specific if (settings._typeNameHandling != null) serializer.TypeNameHandling = settings.TypeNameHandling; - if (settings._specialPropertyHandling != null) - serializer.SpecialPropertyHandling = settings.SpecialPropertyHandling; + if (settings._metadataPropertyHandling != null) + serializer.MetadataPropertyHandling = settings.MetadataPropertyHandling; if (settings._typeNameAssemblyFormat != null) serializer.TypeNameAssemblyFormat = settings.TypeNameAssemblyFormat; if (settings._preserveReferencesHandling != null) diff --git a/Src/Newtonsoft.Json/JsonSerializerSettings.cs b/Src/Newtonsoft.Json/JsonSerializerSettings.cs index 40b6df55b..96949e6da 100644 --- a/Src/Newtonsoft.Json/JsonSerializerSettings.cs +++ b/Src/Newtonsoft.Json/JsonSerializerSettings.cs @@ -45,7 +45,7 @@ public class JsonSerializerSettings internal const PreserveReferencesHandling DefaultPreserveReferencesHandling = PreserveReferencesHandling.None; internal const ConstructorHandling DefaultConstructorHandling = ConstructorHandling.Default; internal const TypeNameHandling DefaultTypeNameHandling = TypeNameHandling.None; - internal const SpecialPropertyHandling DefaultSpecialPropertyHandling = SpecialPropertyHandling.Default; + internal const MetadataPropertyHandling DefaultMetadataPropertyHandling = MetadataPropertyHandling.Default; internal const FormatterAssemblyStyle DefaultTypeNameAssemblyFormat = FormatterAssemblyStyle.Simple; internal static readonly StreamingContext DefaultContext; @@ -84,7 +84,7 @@ public class JsonSerializerSettings internal StreamingContext? _context; internal ConstructorHandling? _constructorHandling; internal TypeNameHandling? _typeNameHandling; - internal SpecialPropertyHandling? _specialPropertyHandling; + internal MetadataPropertyHandling? _metadataPropertyHandling; /// /// Gets or sets how reference loops (e.g. a class referencing itself) is handled. @@ -163,13 +163,13 @@ public TypeNameHandling TypeNameHandling } /// - /// Gets or sets how special properties are used during deserialization. + /// Gets or sets how metadata properties are used during deserialization. /// - /// The special properties handling. - public SpecialPropertyHandling SpecialPropertyHandling + /// The metadata properties handling. + public MetadataPropertyHandling MetadataPropertyHandling { - get { return _specialPropertyHandling ?? DefaultSpecialPropertyHandling; } - set { _specialPropertyHandling = value; } + get { return _metadataPropertyHandling ?? DefaultMetadataPropertyHandling; } + set { _metadataPropertyHandling = value; } } /// diff --git a/Src/Newtonsoft.Json/SpecialPropertyHandling.cs b/Src/Newtonsoft.Json/MetadataPropertyHandling.cs similarity index 81% rename from Src/Newtonsoft.Json/SpecialPropertyHandling.cs rename to Src/Newtonsoft.Json/MetadataPropertyHandling.cs index 406ebc1c8..ddb9dd7b2 100644 --- a/Src/Newtonsoft.Json/SpecialPropertyHandling.cs +++ b/Src/Newtonsoft.Json/MetadataPropertyHandling.cs @@ -30,17 +30,17 @@ namespace Newtonsoft.Json { /// - /// Specifies special property handling options for the . + /// Specifies metadata property handling options for the . /// - public enum SpecialPropertyHandling + public enum MetadataPropertyHandling { /// - /// Read special properties located at the start of a JSON object. + /// Read metadata properties located at the start of a JSON object. /// Default = 0, /// - /// Read special properties located anywhere in a JSON object. Note that this setting will impact performance. + /// Read metadata properties located anywhere in a JSON object. Note that this setting will impact performance. /// ReadAhead = 1, } diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.Net20.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.Net20.csproj index 6c09e7a7d..8e8b2c24b 100644 --- a/Src/Newtonsoft.Json/Newtonsoft.Json.Net20.csproj +++ b/Src/Newtonsoft.Json/Newtonsoft.Json.Net20.csproj @@ -117,6 +117,7 @@ + @@ -126,7 +127,6 @@ - diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.Net35.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.Net35.csproj index 3da55f7b3..0626400d3 100644 --- a/Src/Newtonsoft.Json/Newtonsoft.Json.Net35.csproj +++ b/Src/Newtonsoft.Json/Newtonsoft.Json.Net35.csproj @@ -129,6 +129,7 @@ + @@ -137,7 +138,6 @@ - diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.Net40.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.Net40.csproj index 37ff4285d..b32797fb8 100644 --- a/Src/Newtonsoft.Json/Newtonsoft.Json.Net40.csproj +++ b/Src/Newtonsoft.Json/Newtonsoft.Json.Net40.csproj @@ -130,6 +130,7 @@ + @@ -137,7 +138,6 @@ - diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.Portable.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.Portable.csproj index ed0a2329f..75d4ffac9 100644 --- a/Src/Newtonsoft.Json/Newtonsoft.Json.Portable.csproj +++ b/Src/Newtonsoft.Json/Newtonsoft.Json.Portable.csproj @@ -129,6 +129,7 @@ + @@ -192,7 +193,6 @@ - diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.Portable40.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.Portable40.csproj index d172f8bc8..297f11630 100644 --- a/Src/Newtonsoft.Json/Newtonsoft.Json.Portable40.csproj +++ b/Src/Newtonsoft.Json/Newtonsoft.Json.Portable40.csproj @@ -134,6 +134,7 @@ + @@ -197,7 +198,6 @@ - diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.WinRT.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.WinRT.csproj index a0aea4c69..0a5c37fc9 100644 --- a/Src/Newtonsoft.Json/Newtonsoft.Json.WinRT.csproj +++ b/Src/Newtonsoft.Json/Newtonsoft.Json.WinRT.csproj @@ -263,7 +263,7 @@ - + diff --git a/Src/Newtonsoft.Json/Newtonsoft.Json.csproj b/Src/Newtonsoft.Json/Newtonsoft.Json.csproj index 52f5d6852..db947fa05 100644 --- a/Src/Newtonsoft.Json/Newtonsoft.Json.csproj +++ b/Src/Newtonsoft.Json/Newtonsoft.Json.csproj @@ -133,10 +133,10 @@ + - diff --git a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs index 87829cdf2..9d2b4f38e 100644 --- a/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs +++ b/Src/Newtonsoft.Json/Properties/AssemblyInfo.cs @@ -91,5 +91,5 @@ // by using the '*' as shown below: [assembly: AssemblyVersion("6.0.0.0")] -[assembly: AssemblyFileVersion("6.0.2.17226")] +[assembly: AssemblyFileVersion("6.0.3.17227")] [assembly: CLSCompliant(true)] diff --git a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs index c290b1d73..cc5b20cfb 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs @@ -226,7 +226,7 @@ private JToken CreateJObject(JsonReader reader) { ValidationUtils.ArgumentNotNull(reader, "reader"); - // this is needed because we've already read inside the object, looking for special properties + // this is needed because we've already read inside the object, looking for metadata properties using (JTokenWriter writer = new JTokenWriter()) { writer.WriteStartObject(); @@ -376,7 +376,7 @@ private object CreateObject(JsonReader reader, Type objectType, JsonContract con object newValue; Type resolvedObjectType = objectType; - if (Serializer.SpecialPropertyHandling == SpecialPropertyHandling.ReadAhead) + if (Serializer.MetadataPropertyHandling == MetadataPropertyHandling.ReadAhead) { var tokenReader = reader as JTokenReader; if (tokenReader == null) @@ -390,13 +390,13 @@ private object CreateObject(JsonReader reader, Type objectType, JsonContract con reader = tokenReader; } - if (ReadSpecialPropertiesToken(tokenReader, ref resolvedObjectType, ref contract, member, containerContract, containerMember, existingValue, out newValue, out id)) + if (ReadMetadataPropertiesToken(tokenReader, ref resolvedObjectType, ref contract, member, containerContract, containerMember, existingValue, out newValue, out id)) return newValue; } else { CheckedRead(reader); - if (ReadSpecialProperties(reader, ref resolvedObjectType, ref contract, member, containerContract, containerMember, existingValue, out newValue, out id)) + if (ReadMetadataProperties(reader, ref resolvedObjectType, ref contract, member, containerContract, containerMember, existingValue, out newValue, out id)) return newValue; } @@ -508,7 +508,7 @@ private object CreateObject(JsonReader reader, Type objectType, JsonContract con ".FormatWith(CultureInfo.InvariantCulture, resolvedObjectType, GetExpectedDescription(contract))); } - private bool ReadSpecialPropertiesToken(JTokenReader reader, ref Type objectType, ref JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, object existingValue, out object newValue, out string id) + private bool ReadMetadataPropertiesToken(JTokenReader reader, ref Type objectType, ref JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, object existingValue, out object newValue, out string id) { id = null; newValue = null; @@ -592,7 +592,7 @@ private bool ReadSpecialPropertiesToken(JTokenReader reader, ref Type objectType return false; } - private bool ReadSpecialProperties(JsonReader reader, ref Type objectType, ref JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, object existingValue, out object newValue, out string id) + private bool ReadMetadataProperties(JsonReader reader, ref Type objectType, ref JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, object existingValue, out object newValue, out string id) { id = null; newValue = null; @@ -603,9 +603,9 @@ private bool ReadSpecialProperties(JsonReader reader, ref Type objectType, ref J if (propertyName.Length > 0 && propertyName[0] == '$') { - // read 'special' properties + // read metadata properties // $type, $id, $ref, etc - bool specialProperty; + bool metadataProperty; do { @@ -635,7 +635,7 @@ private bool ReadSpecialProperties(JsonReader reader, ref Type objectType, ref J } else { - specialProperty = true; + metadataProperty = true; } } else if (string.Equals(propertyName, JsonTypeReflector.TypePropertyName, StringComparison.Ordinal)) @@ -647,7 +647,7 @@ private bool ReadSpecialProperties(JsonReader reader, ref Type objectType, ref J CheckedRead(reader); - specialProperty = true; + metadataProperty = true; } else if (string.Equals(propertyName, JsonTypeReflector.IdPropertyName, StringComparison.Ordinal)) { @@ -656,7 +656,7 @@ private bool ReadSpecialProperties(JsonReader reader, ref Type objectType, ref J id = (reader.Value != null) ? reader.Value.ToString() : null; CheckedRead(reader); - specialProperty = true; + metadataProperty = true; } else if (string.Equals(propertyName, JsonTypeReflector.ArrayValuesPropertyName, StringComparison.Ordinal)) { @@ -668,10 +668,9 @@ private bool ReadSpecialProperties(JsonReader reader, ref Type objectType, ref J } else { - specialProperty = false; + metadataProperty = false; } - } while (specialProperty - && reader.TokenType == JsonToken.PropertyName); + } while (metadataProperty && reader.TokenType == JsonToken.PropertyName); } } return false; @@ -1953,7 +1952,7 @@ private object PopulateObject(object newObject, JsonReader reader, JsonObjectCon private bool CheckPropertyName(JsonReader reader, string memberName) { - if (Serializer.SpecialPropertyHandling == SpecialPropertyHandling.ReadAhead) + if (Serializer.MetadataPropertyHandling == MetadataPropertyHandling.ReadAhead) { switch (memberName) { diff --git a/Src/Newtonsoft.Json/Serialization/JsonSerializerProxy.cs b/Src/Newtonsoft.Json/Serialization/JsonSerializerProxy.cs index 7016f4235..a3f3a3220 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonSerializerProxy.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonSerializerProxy.cs @@ -108,10 +108,10 @@ public override TypeNameHandling TypeNameHandling set { _serializer.TypeNameHandling = value; } } - public override SpecialPropertyHandling SpecialPropertyHandling + public override MetadataPropertyHandling MetadataPropertyHandling { - get { return _serializer.SpecialPropertyHandling; } - set { _serializer.SpecialPropertyHandling = value; } + get { return _serializer.MetadataPropertyHandling; } + set { _serializer.MetadataPropertyHandling = value; } } public override FormatterAssemblyStyle TypeNameAssemblyFormat