1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/comprehend/model/PiiEntity.h>
7 #include <aws/core/utils/json/JsonSerializer.h>
8
9 #include <utility>
10
11 using namespace Aws::Utils::Json;
12 using namespace Aws::Utils;
13
14 namespace Aws
15 {
16 namespace Comprehend
17 {
18 namespace Model
19 {
20
PiiEntity()21 PiiEntity::PiiEntity() :
22 m_score(0.0),
23 m_scoreHasBeenSet(false),
24 m_type(PiiEntityType::NOT_SET),
25 m_typeHasBeenSet(false),
26 m_beginOffset(0),
27 m_beginOffsetHasBeenSet(false),
28 m_endOffset(0),
29 m_endOffsetHasBeenSet(false)
30 {
31 }
32
PiiEntity(JsonView jsonValue)33 PiiEntity::PiiEntity(JsonView jsonValue) :
34 m_score(0.0),
35 m_scoreHasBeenSet(false),
36 m_type(PiiEntityType::NOT_SET),
37 m_typeHasBeenSet(false),
38 m_beginOffset(0),
39 m_beginOffsetHasBeenSet(false),
40 m_endOffset(0),
41 m_endOffsetHasBeenSet(false)
42 {
43 *this = jsonValue;
44 }
45
operator =(JsonView jsonValue)46 PiiEntity& PiiEntity::operator =(JsonView jsonValue)
47 {
48 if(jsonValue.ValueExists("Score"))
49 {
50 m_score = jsonValue.GetDouble("Score");
51
52 m_scoreHasBeenSet = true;
53 }
54
55 if(jsonValue.ValueExists("Type"))
56 {
57 m_type = PiiEntityTypeMapper::GetPiiEntityTypeForName(jsonValue.GetString("Type"));
58
59 m_typeHasBeenSet = true;
60 }
61
62 if(jsonValue.ValueExists("BeginOffset"))
63 {
64 m_beginOffset = jsonValue.GetInteger("BeginOffset");
65
66 m_beginOffsetHasBeenSet = true;
67 }
68
69 if(jsonValue.ValueExists("EndOffset"))
70 {
71 m_endOffset = jsonValue.GetInteger("EndOffset");
72
73 m_endOffsetHasBeenSet = true;
74 }
75
76 return *this;
77 }
78
Jsonize() const79 JsonValue PiiEntity::Jsonize() const
80 {
81 JsonValue payload;
82
83 if(m_scoreHasBeenSet)
84 {
85 payload.WithDouble("Score", m_score);
86
87 }
88
89 if(m_typeHasBeenSet)
90 {
91 payload.WithString("Type", PiiEntityTypeMapper::GetNameForPiiEntityType(m_type));
92 }
93
94 if(m_beginOffsetHasBeenSet)
95 {
96 payload.WithInteger("BeginOffset", m_beginOffset);
97
98 }
99
100 if(m_endOffsetHasBeenSet)
101 {
102 payload.WithInteger("EndOffset", m_endOffset);
103
104 }
105
106 return payload;
107 }
108
109 } // namespace Model
110 } // namespace Comprehend
111 } // namespace Aws
112