1
-
2
1
/**
3
2
* Decorator metadata definition for JsonProperty
4
3
*/
5
4
export interface JsonPropertyDecoratorMetadata {
6
- name ?: string , //name of the JSON property to map
7
- required ?: boolean , //is this field required in the JSON object that is being deserialized
8
- access ?: AccessType , //is this serializable and de-serializable
9
- type ?: any //the type of Object that should be assigned to this property
10
- serializer ?: any , //Serializer for the type
11
- deserializer ?: any // deserializer for the type
5
+ name ?: string ; //name of the JSON property to map
6
+ required ?: boolean ; //is this field required in the JSON object that is being deserialized
7
+ access ?: AccessType ; //is this serializable and de-serializable
8
+ type ?: any ; //the type of Object that should be assigned to this property
9
+ serializer ?: any ; //Serializer for the type
10
+ deserializer ?: any ; // deserializer for the type
12
11
}
13
12
14
13
export enum AccessType {
15
- READ_ONLY , WRITE_ONLY , BOTH
14
+ READ_ONLY ,
15
+ WRITE_ONLY ,
16
+ BOTH ,
16
17
}
17
18
18
- export interface Serializer {
19
- serialize ( value : any ) : any ;
19
+ export interface Serializer {
20
+ serialize ( value : any ) : any ;
20
21
}
21
22
22
- export interface Deserializer {
23
- deserialize ( value : any ) : any ;
23
+ export interface Deserializer {
24
+ deserialize ( value : any ) : any ;
24
25
}
25
26
26
27
/**
27
28
* JsonProperty Decorator function.
28
29
*/
29
- export declare function JsonProperty ( metadata ?: JsonPropertyDecoratorMetadata ) : any ;
30
+ export declare function JsonProperty (
31
+ metadata ?: JsonPropertyDecoratorMetadata
32
+ ) : any ;
30
33
31
34
/**
32
35
* Decorator for specifying cache key.
33
36
* Used for Serializer/Deserializer caching.
34
- *
37
+ *
35
38
* @export
36
- * @param {string } key
37
- * @returns
39
+ * @param {string } key
40
+ * @returns
38
41
*/
39
42
export function CacheKey ( key : string ) : Function ;
40
43
@@ -48,32 +51,41 @@ export declare function JsonIgnore(): any;
48
51
*/
49
52
export declare function JsonConverstionError ( message : string , json : any ) : Error ;
50
53
51
- export declare namespace ObjectMapper {
54
+ export interface DeserializationConfig {
55
+ ignoreNameMetadata : boolean ;
56
+ }
52
57
53
- /**
54
- * Deserializes a Object type with the passed on JSON data.
55
- */
56
- export function deserialize < T > ( type : { new ( ) : T } , json : Object ) : T ;
58
+ export declare namespace ObjectMapper {
59
+ /**
60
+ * Deserializes a Object type with the passed on JSON data.
61
+ */
62
+ export function deserialize < T > (
63
+ type : { new ( ) : T } ,
64
+ json : Object ,
65
+ config ?: DeserializationConfig
66
+ ) : T ;
57
67
58
- /**
59
- * Deserializes an array of object types with the passed on JSON data.
60
- */
61
- export function deserializeArray < T > ( type : { new ( ) : T } , json : Object ) : T [ ] ;
68
+ /**
69
+ * Deserializes an array of object types with the passed on JSON data.
70
+ */
71
+ export function deserializeArray < T > (
72
+ type : { new ( ) : T } ,
73
+ json : Object ,
74
+ config ?: DeserializationConfig
75
+ ) : T [ ] ;
62
76
63
- /**
64
- * Serializes an object instance to JSON string.
65
- */
66
- export function serialize ( obj : any ) : String ;
67
-
77
+ /**
78
+ * Serializes an object instance to JSON string.
79
+ */
80
+ export function serialize ( obj : any ) : String ;
68
81
}
69
82
70
83
/**
71
84
* Default Date serializer implementation.
72
- *
85
+ *
73
86
* @class DateSerializer
74
87
* @implements {Serializer}
75
88
*/
76
89
export declare class DateSerializer implements Serializer {
77
- public serialize ( value : Date ) : number ;
90
+ public serialize ( value : Date ) : number ;
78
91
}
79
-
0 commit comments