Mapper.apex

  • Docs
  • Tutorials
Docs Menu
  • Mapping
  • Methods
  • Mapper.DTO

Mapper.DTO Guide

Mapper.DTO

Mapper.DTO Reference

Mapper.DTO is a wrapper object for nested maps.

Mapper.DTO d = new Mapper.DTO();
d.setObject('a.b.c', 'test');
Boolean flag = d.getBoolean('task.terminated');

Constructors

Here are the constructors.

ConstructorDescription
DTO()Constrcutor to create an empty DTO
DTO(DTO)Constructor to create an instance from another DTO
DTO(String)Constructor to create an instance from a JSON string
DTO(Map)Constructor to create an instance from a Map
DTO(SObject)Constructor to create an instance from an SObject
DTO(Object)Constrcutor to create an instance from an Object
Mapper.DTO d = new MapperDTO();

Query

Here are the query APIs.

MethodDescription
keySet()Get the keys of the DTO
containsPath(List)Check if the DTO has the path
containsPath(String)Check if the DTO has the path

Conversion

Here are the methods to convert DTO to other objects.

MethodDescription
toMap()Convert to Map
toJSON()Convert to JSON string
toObject(Type)Convert to Object of the given type
toSObject(Type)Convert to SObject of the given type
Mapper.DTO d = new MapperDTO();
Map m = d.toMap();

Accessors

Here are the getters/setters for DTOs.

MethodDescription
setObject(List, Object)Set the value at the path
setObject(String, Object)Set the value at the path
getObject(List)Get the value at the path
getObject(String)Get the value at the path
setBoolean(List, Object)Set the value at the path
setBoolean(String, Object)Set the value at the path
getBoolean(List)Get the value at the path
getBoolean(String)Get the value at the path
setInteger(List, Object)Set the value at the path
setInteger(String, Object)Set the value at the path
getInteger(List)Get the value at the path
getInteger(String)Get the value at the path
setLong(List, Object)Set the value at the path
setLong(String, Object)Set the value at the path
getLong(List)Get the value at the path
getLong(String)Get the value at the path
setDouble(List, Object)Set the value at the path
setDouble(String, Object)Set the value at the path
getDouble(List)Get the value at the path
getDouble(String)Get the value at the path
setDecimal(List, Object)Set the value at the path
setDecimal(String, Object)Set the value at the path
getDecimal(List)Get the value at the path
getDecimal(String)Get the value at the path
setString(List, Object)Set the value at the path
setString(String, Object)Set the value at the path
getString(List)Get the value at the path
getString(String)Get the value at the path
setList(List, Object)Set the value at the path
setList(String, Object)Set the value at the path
getList(List)Get the value at the path
getList(String)Get the value at the path
setSet(List, Object)Set the value at the path
setSet(String, Object)Set the value at the path
getSet(List)Get the value at the path
getSet(String)Get the value at the path
setMap(List, Object)Set the value at the path
setMap(String, Object)Set the value at the path
getMap(List)Get the value at the path
getMap(String)Get the value at the path
setSObject(List, Object)Set the value at the path
setSObject(String, Object)Set the value at the path
getSObject(List)Get the value at the path
getSObject(String)Get the value at the path
setDate(List, Object)Set the value at the path
setDate(String, Object)Set the value at the path
getDate(List)Get the value at the path
getDate(String)Get the value at the path
setTime(List, Object)Set the value at the path
setTime(String, Object)Set the value at the path
getTime(List)Get the value at the path
getTime(String)Get the value at the path
setDatetime(List, Object)Set the value at the path
setDatetime(String, Object)Set the value at the path
getDatetime(List)Get the value at the path
getDatetime(String)Get the value at the path
setFunc(List, Object)Set the value at the path
setFunc(String, Object)Set the value at the path
getFunc(List)Get the value at the path
getFunc(String)Get the value at the path
Mapper.DTO d = new MapperDTO();
d.setInteger('age', 30);

Contribute on Github! Edit this section.