JsonBoolValidator.cs
1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
namespace UniJSON
{
public class JsonBoolValidator : IJsonSchemaValidator
{
public override int GetHashCode()
{
return 1;
}
public override bool Equals(object obj)
{
var rhs = obj as JsonBoolValidator;
if (rhs == null) return false;
return true;
}
public void Merge(IJsonSchemaValidator obj)
{
throw new NotImplementedException();
}
public bool FromJsonSchema(IFileSystemAccessor fs, string key, ListTreeNode<JsonValue> value)
{
return false;
}
public void ToJsonScheama(IFormatter f)
{
f.Key("type"); f.Value("boolean");
}
public JsonSchemaValidationException Validate<T>(JsonSchemaValidationContext c, T value)
{
return null;
}
public void Serialize<T>(IFormatter f, JsonSchemaValidationContext c, T value)
{
f.Serialize(value);
}
public void Deserialize<T, U>(ListTreeNode<T> src, ref U dst)
where T : IListTreeItem, IValue<T>
{
dst = GenericCast<bool, U>.Cast(src.GetBoolean());
}
}
}