-
Notifications
You must be signed in to change notification settings - Fork 122
Converters
Michael Dostál edited this page Nov 14, 2018
·
3 revisions
Every converter needs to implement PropertyConverter interface
export interface PropertyConverter {
mask(value: any): any;
unmask(value: any): any;
}
class ValueConverter implements PropertyConverter{
mask(value:any){
// your logic for deserialization
}
unmask(value:any){
// your logic for serialization
}
}
Converters can be used in @Attribute, @NestedAttribute and @JsonAttribute decorators like this:
@Attribute({converter: new ValueConverter()}
value:any;