Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
JsonTypeInfoInternal.cs
Go to the documentation of this file.
1
using
System.Text.Json.Serialization.Converters
;
2
3
namespace
System.Text.Json.Serialization.Metadata
;
4
5
internal
sealed
class
JsonTypeInfoInternal
<T> :
JsonTypeInfo
<T>
6
{
7
public
JsonTypeInfoInternal
(
JsonSerializerOptions
options
)
8
:
base
(
typeof
(T),
options
)
9
{
10
}
11
12
public
JsonTypeInfoInternal
(
JsonSerializerOptions
options
,
JsonObjectInfoValues<T>
objectInfo
)
13
:
base
(
typeof
(T),
options
)
14
{
15
JsonConverter
converter
;
16
if
(
objectInfo
.ObjectWithParameterizedConstructorCreator !=
null
)
17
{
18
converter
=
new
JsonMetadataServicesConverter<T>
(() =>
new
LargeObjectWithParameterizedConstructorConverter<T>
(),
ConverterStrategy
.Object);
19
base.CreateObjectWithArgs
=
objectInfo
.ObjectWithParameterizedConstructorCreator;
20
CtorParamInitFunc
=
objectInfo
.ConstructorParameterMetadataInitializer;
21
}
22
else
23
{
24
converter
=
new
JsonMetadataServicesConverter<T>
(() =>
new
ObjectDefaultConverter<T>
(),
ConverterStrategy
.Object);
25
SetCreateObjectFunc
(
objectInfo
.ObjectCreator);
26
}
27
PropInitFunc
=
objectInfo
.PropertyMetadataInitializer;
28
base.SerializeHandler
=
objectInfo
.SerializeHandler;
29
base.PropertyInfoForTypeInfo
=
JsonMetadataServices
.
CreateJsonPropertyInfoForClassInfo
(
typeof
(T),
this
,
converter
,
base
.Options);
30
base.NumberHandling
=
objectInfo
.NumberHandling;
31
}
32
33
public
JsonTypeInfoInternal
(
JsonSerializerOptions
options
,
JsonCollectionInfoValues<T>
collectionInfo
, Func<
JsonConverter<T>
>
converterCreator
,
object
createObjectWithArgs
=
null
,
object
addFunc
=
null
)
34
:
base
(
typeof
(T),
options
)
35
{
36
if
(
collectionInfo
==
null
)
37
{
38
throw
new
ArgumentNullException
(
"collectionInfo"
);
39
}
40
JsonConverter<T>
jsonConverter
=
new
JsonMetadataServicesConverter<T>
(
converterCreator
, (
collectionInfo
.KeyInfo ==
null
) ?
ConverterStrategy
.Enumerable :
ConverterStrategy
.Dictionary);
41
base.KeyType
=
jsonConverter
.
KeyType
;
42
base.ElementType
=
jsonConverter
.ElementType;
43
base.KeyTypeInfo
=
collectionInfo
.KeyInfo;
44
base.ElementTypeInfo
=
collectionInfo.ElementInfo
??
throw
new
ArgumentNullException
(
"ElementInfo"
);
45
base.NumberHandling
=
collectionInfo
.NumberHandling;
46
base.PropertyInfoForTypeInfo
=
JsonMetadataServices
.
CreateJsonPropertyInfoForClassInfo
(
typeof
(T),
this
,
jsonConverter
,
options
);
47
base.SerializeHandler
=
collectionInfo
.SerializeHandler;
48
base.CreateObjectWithArgs
=
createObjectWithArgs
;
49
base.AddMethodDelegate
=
addFunc
;
50
SetCreateObjectFunc
(
collectionInfo
.ObjectCreator);
51
}
52
53
private
void
SetCreateObjectFunc
(Func<T>
createObjectFunc
)
54
{
55
if
(
createObjectFunc
!=
null
)
56
{
57
base.CreateObject
= () =>
createObjectFunc
();
58
}
59
}
60
}
System.ArgumentNullException
Definition
ArgumentNullException.cs:10
System.Text.Json.JsonSerializerOptions
Definition
JsonSerializerOptions.cs:17
System.Text.Json.Serialization.Converters.LargeObjectWithParameterizedConstructorConverter
Definition
LargeObjectWithParameterizedConstructorConverter.cs:8
System.Text.Json.Serialization.Converters.ObjectDefaultConverter
Definition
ObjectDefaultConverter.cs:9
System.Text.Json.Serialization.JsonConverter.KeyType
Type? KeyType
Definition
JsonConverter.cs:22
System.Text.Json.Serialization.JsonConverter
Definition
JsonConverter.cs:119
System.Text.Json.Serialization.Metadata.JsonCollectionInfoValues
Definition
JsonCollectionInfoValues.cs:4
System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateJsonPropertyInfoForClassInfo
static JsonPropertyInfo CreateJsonPropertyInfoForClassInfo(Type type, JsonTypeInfo typeInfo, JsonConverter converter, JsonSerializerOptions options)
Definition
JsonMetadataServices.cs:309
System.Text.Json.Serialization.Metadata.JsonMetadataServices
Definition
JsonMetadataServices.cs:12
System.Text.Json.Serialization.Metadata.JsonObjectInfoValues
Definition
JsonObjectInfoValues.cs:4
System.Text.Json.Serialization.Metadata.JsonTypeInfoInternal.JsonTypeInfoInternal
JsonTypeInfoInternal(JsonSerializerOptions options)
Definition
JsonTypeInfoInternal.cs:7
System.Text.Json.Serialization.Metadata.JsonTypeInfoInternal.JsonTypeInfoInternal
JsonTypeInfoInternal(JsonSerializerOptions options, JsonObjectInfoValues< T > objectInfo)
Definition
JsonTypeInfoInternal.cs:12
System.Text.Json.Serialization.Metadata.JsonTypeInfoInternal.JsonTypeInfoInternal
JsonTypeInfoInternal(JsonSerializerOptions options, JsonCollectionInfoValues< T > collectionInfo, Func< JsonConverter< T > > converterCreator, object createObjectWithArgs=null, object addFunc=null)
Definition
JsonTypeInfoInternal.cs:33
System.Text.Json.Serialization.Metadata.JsonTypeInfoInternal.SetCreateObjectFunc
void SetCreateObjectFunc(Func< T > createObjectFunc)
Definition
JsonTypeInfoInternal.cs:53
System.Text.Json.Serialization.Metadata.JsonTypeInfoInternal
Definition
JsonTypeInfoInternal.cs:6
System.Text.Json.Serialization.Metadata.JsonTypeInfo.PropInitFunc
Func< JsonSerializerContext, JsonPropertyInfo[]> PropInitFunc
Definition
JsonTypeInfo.cs:98
System.Text.Json.Serialization.Metadata.JsonTypeInfo.CtorParamInitFunc
Func< JsonParameterInfoValues[]> CtorParamInitFunc
Definition
JsonTypeInfo.cs:100
System.Text.Json.Serialization.Metadata.JsonTypeInfo
Definition
JsonTypeInfo.cs:14
System.Text.Json.Serialization.Converters
Definition
ArrayConverter.cs:3
System.Text.Json.Serialization.Metadata
Definition
FSharpCoreReflectionProxy.cs:5
System.Text.Json.ConverterStrategy
ConverterStrategy
Definition
ConverterStrategy.cs:4
System.Text.Json.ConverterStrategy.Dictionary
@ Dictionary
System.ExceptionArgument.converter
@ converter
System.ExceptionArgument.options
@ options
source
System.Text.Json
System.Text.Json.Serialization.Metadata
JsonTypeInfoInternal.cs
Generated by
1.10.0