LOM2M  0.8.0
Static Public Member Functions | List of all members
Mapper Class Reference

#include <JsonMapper.h>

Static Public Member Functions

static int mapResourceAttributes (JsonObject jsonObj, Entity *e, int level=0, bool restCreation=false, bool mapAll=false)
 
static int mapGenericAttributes (JsonObject jsonObj, Entity *e, int level=0, bool restCreation=false, bool mapAll=false)
 
static int mapGenericModifiedAttributes (JsonObject jsonObj, Entity *e)
 
static int mapChildResourcesRef (JsonObject jsonObj, Entity *e, int level=0, bool restCreation=false, bool mapAll=false)
 
static int mapChildResources (JsonObject jsonObj, Entity *e, int level=0, bool restCreation=false, bool mapAll=false)
 
static int parseGenericAttributes (JsonObject jsonObj, Entity *e)
 

Detailed Description

Provide generic mappers to map attributes from resources in memory (entity) Works on provided json Objects

Member Function Documentation

◆ mapChildResources()

int Mapper::mapChildResources ( JsonObject  jsonObj,
Entity e,
int  level = 0,
bool  restCreation = false,
bool  mapAll = false 
)
static

Map child resources (will map attributes of child resources of target entity) Will go recursively if level is > 1

Parameters
jsonObjroot of the json object used to map the resource
eentity to map to a json object
levellevel of depth of mapping (in case of mapping with children resources)
restCreationboolean used to avoid serializing non permitted attributes (useful for REST creation of resource)
mapAllinternal parameter used for full serialization of all entities
Returns
int different from 0 if an error occurs

◆ mapChildResourcesRef()

int Mapper::mapChildResourcesRef ( JsonObject  jsonObj,
Entity e,
int  level = 0,
bool  restCreation = false,
bool  mapAll = false 
)
static

Map child resources references (name, type, uri)

Parameters
jsonObjroot of the json object used to map the resource
eentity to map to a json object
levellevel of depth of mapping (in case of mapping with children resources)
restCreationboolean used to avoid serializing non permitted attributes (useful for REST creation of resource)
mapAllinternal parameter used for full serialization of all entities
Returns
int different from 0 if an error occurs

◆ mapGenericAttributes()

int Mapper::mapGenericAttributes ( JsonObject  jsonObj,
Entity e,
int  level = 0,
bool  restCreation = false,
bool  mapAll = false 
)
static

Map generic atributes of resources (such as creation time, labels, etc.)

Parameters
jsonObjroot of the json object used to map the resource
eentity to map to a json object
levellevel of depth of mapping (in case of mapping with children resources)
restCreationboolean used to avoid serializing non permitted attributes (useful for REST creation of resource)
mapAllinternal parameter used for full serialization of all entities
Returns
int different from 0 if an error occurs

◆ mapGenericModifiedAttributes()

int Mapper::mapGenericModifiedAttributes ( JsonObject  jsonObj,
Entity e 
)
static

Map only modified attributes based on global list MODIFIEDATTRIBUTES

Parameters
jsonObjectroot of the json object used to map the resource
ethe entity to be mapped
levellevel of depth of the mapping
Returns
int different from 0 if an error occurs

◆ mapResourceAttributes()

int Mapper::mapResourceAttributes ( JsonObject  jsonObj,
Entity e,
int  level = 0,
bool  restCreation = false,
bool  mapAll = false 
)
static

Map all atributes of any resource (will use specific mappers to do so)

Parameters
jsonObjroot of the json object used to map the resource
eentity to map to a json object
levellevel of depth of mapping (in case of mapping with children resources)
restCreationboolean used to avoid serializing non permitted attributes (useful for REST creation of resource)
mapAllinternal parameter used for full serialization of all entities
Returns
int different from 0 if an error occurs

◆ parseGenericAttributes()

int Mapper::parseGenericAttributes ( JsonObject  jsonObj,
Entity e 
)
static

Parse generic attributes of entity Used to load attributes (for persistence only) The loaded attributes are mostly NP attributes at creation and / or update

Parameters
jsonObjroot of the json object to load in memory
entitythe entity with parameter to be loaded

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