Fawkes API Fawkes Development Version
DomainObjectType Class Reference

DomainObjectType representation for JSON transfer. More...

#include <DomainObjectType.h>

Public Member Functions

 DomainObjectType ()
 Constructor. More...
 
 DomainObjectType (const std::string &json)
 Constructor from JSON. More...
 
 DomainObjectType (const rapidjson::Value &v)
 Constructor from JSON. More...
 
virtual ~DomainObjectType ()
 Destructor. More...
 
virtual std::string to_json (bool pretty=false) const
 Render object to JSON. More...
 
virtual void to_json_value (rapidjson::Document &d, rapidjson::Value &v) const
 Render object to JSON. More...
 
virtual void from_json (const std::string &json)
 Retrieve data from JSON string. More...
 
virtual void from_json_value (const rapidjson::Value &v)
 Retrieve data from JSON string. More...
 
virtual void validate (bool subcall=false) const
 Validate if all required fields have been set. More...
 
std::optional< std::string > kind () const
 Get kind value. More...
 
void set_kind (const std::string &kind)
 Set kind value. More...
 
std::optional< std::string > apiVersion () const
 Get apiVersion value. More...
 
void set_apiVersion (const std::string &apiVersion)
 Set apiVersion value. More...
 
std::optional< std::string > name () const
 Get name value. More...
 
void set_name (const std::string &name)
 Set name value. More...
 
std::optional< std::string > super_type () const
 Get super-type value. More...
 
void set_super_type (const std::string &super_type)
 Set super-type value. More...
 

Static Public Member Functions

static std::string api_version ()
 Get version of implemented API. More...
 

Detailed Description

DomainObjectType representation for JSON transfer.

Definition at line 27 of file DomainObjectType.h.

Constructor & Destructor Documentation

◆ DomainObjectType() [1/3]

DomainObjectType::DomainObjectType ( )

Constructor.

Definition at line 24 of file DomainObjectType.cpp.

◆ DomainObjectType() [2/3]

DomainObjectType::DomainObjectType ( const std::string &  json)

Constructor from JSON.

Parameters
jsonJSON string to initialize from

Definition at line 28 of file DomainObjectType.cpp.

References from_json().

◆ DomainObjectType() [3/3]

DomainObjectType::DomainObjectType ( const rapidjson::Value &  v)

Constructor from JSON.

Parameters
vRapidJSON value object to initialize from.

Definition at line 33 of file DomainObjectType.cpp.

References from_json_value().

◆ ~DomainObjectType()

DomainObjectType::~DomainObjectType ( )
virtual

Destructor.

Definition at line 38 of file DomainObjectType.cpp.

Member Function Documentation

◆ api_version()

static std::string DomainObjectType::api_version ( )
inlinestatic

Get version of implemented API.

Returns
string representation of version

Definition at line 48 of file DomainObjectType.h.

◆ apiVersion()

std::optional< std::string > DomainObjectType::apiVersion ( ) const
inline

Get apiVersion value.

Returns
apiVersion value

Definition at line 109 of file DomainObjectType.h.

Referenced by set_apiVersion().

◆ from_json()

void DomainObjectType::from_json ( const std::string &  json)
virtual

Retrieve data from JSON string.

Parameters
jsonJSON representation suitable for this object. Will allow partial assignment and not validate automaticaly.
See also
validate()

Definition at line 92 of file DomainObjectType.cpp.

References from_json_value().

Referenced by DomainObjectType().

◆ from_json_value()

void DomainObjectType::from_json_value ( const rapidjson::Value &  v)
virtual

Retrieve data from JSON string.

Parameters
vRapidJSON value suitable for this object. Will allow partial assignment and not validate automaticaly.
See also
validate()

Definition at line 101 of file DomainObjectType.cpp.

Referenced by DomainObjectType(), and from_json().

◆ kind()

std::optional< std::string > DomainObjectType::kind ( ) const
inline

Get kind value.

Returns
kind value

Definition at line 92 of file DomainObjectType.h.

Referenced by set_kind().

◆ name()

std::optional< std::string > DomainObjectType::name ( ) const
inline

Get name value.

Returns
name value

Definition at line 126 of file DomainObjectType.h.

Referenced by set_name().

◆ set_apiVersion()

void DomainObjectType::set_apiVersion ( const std::string &  apiVersion)
inline

Set apiVersion value.

Parameters
apiVersionnew value

Definition at line 118 of file DomainObjectType.h.

References apiVersion().

◆ set_kind()

void DomainObjectType::set_kind ( const std::string &  kind)
inline

Set kind value.

Parameters
kindnew value

Definition at line 101 of file DomainObjectType.h.

References kind().

◆ set_name()

void DomainObjectType::set_name ( const std::string &  name)
inline

Set name value.

Parameters
namenew value

Definition at line 135 of file DomainObjectType.h.

References name().

◆ set_super_type()

void DomainObjectType::set_super_type ( const std::string &  super_type)
inline

Set super-type value.

Parameters
super_typenew value

Definition at line 152 of file DomainObjectType.h.

References super_type().

◆ super_type()

std::optional< std::string > DomainObjectType::super_type ( ) const
inline

Get super-type value.

Returns
super-type value

Definition at line 143 of file DomainObjectType.h.

Referenced by set_super_type().

◆ to_json()

std::string DomainObjectType::to_json ( bool  pretty = false) const
virtual

Render object to JSON.

Parameters
prettytrue to enable pretty printing (readable spacing)
Returns
JSON string

Definition at line 43 of file DomainObjectType.cpp.

References to_json_value().

◆ to_json_value()

void DomainObjectType::to_json_value ( rapidjson::Document &  d,
rapidjson::Value &  v 
) const
virtual

Render object to JSON.

Parameters
dRapidJSON document to retrieve allocator from
vRapidJSON value to add data to

Definition at line 62 of file DomainObjectType.cpp.

Referenced by to_json().

◆ validate()

void DomainObjectType::validate ( bool  subcall = false) const
virtual

Validate if all required fields have been set.

Parameters
subcalltrue if this is called from another class, e.g., a sub-class or array holder. Will modify the kind of exception thrown.
Exceptions
std::vector<std::string>thrown if required information is missing and subcall is set to true. Contains a list of missing fields.
std::runtime_errorinformative message describing the missing fields

Definition at line 118 of file DomainObjectType.cpp.


The documentation for this class was generated from the following files: