public class ZendriveDriverAttributes extends Object
The application can specify both predefined and custom attributes for a driver. These attributes are associated with a SDK driverId at SDK initialization time. In addition to predefined special attributes, up to 4 custom key value attributes can be associated with a driver of the Zendrive SDK. These attributes are available on the Zendrive dashboard and via the API.
All attribute keys and values can be upto 64 characters in length. Longer keys and values will be truncated to the first 64 characters.
Modifier and Type | Class and Description |
---|---|
static class |
ZendriveDriverAttributes.ServiceLevel
Enumeration for different service levels supported by Zendrive for a driver.
|
Constructor and Description |
---|
ZendriveDriverAttributes() |
ZendriveDriverAttributes(JSONObject jsonObject)
Construct ZendriveDriverAttributes from JSON.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
String |
getAlias()
Returns the alias of the driver if set or null.
|
String |
getCustomAttribute(String key)
Returns the specified custom attribute if set or null.
|
String |
getGroup()
Returns the group id of the driver if set or null.
|
String |
getJsonForUpload()
Get the json format to upload attributes.
|
ZendriveDriverAttributes.ServiceLevel |
getServiceLevel() |
ZendriveVehicleType |
getVehicleType()
Returns the vehicle type of the driver if set or null.
|
int |
hashCode() |
void |
setAlias(String alias)
Set an alias for the driver.
|
void |
setCustomAttribute(String key,
String value)
Set the custom attribute of the driver.
|
void |
setGroup(String groupId)
Set the group id of the driver.
|
void |
setServiceLevel(ZendriveDriverAttributes.ServiceLevel priority)
The service level of a driver.
|
void |
setVehicleType(ZendriveVehicleType vehicleType)
Set the vehicle type for the driver.
|
JSONObject |
toJson()
Return the json representation of this object.
|
public ZendriveDriverAttributes()
public ZendriveDriverAttributes(JSONObject jsonObject) throws JSONException
jsonObject
- The json object representing ZendriveDriverAttributes.JSONException
- if the json object could not be parsed.public void setAlias(String alias)
alias
- The alias for the driver.public void setGroup(String groupId)
groupId
- The group id of the driver.public void setServiceLevel(ZendriveDriverAttributes.ServiceLevel priority)
ZendriveDriverAttributes.ServiceLevel
for more information about this attribute.public void setVehicleType(ZendriveVehicleType vehicleType)
ZendriveVehicleType.CAR
,
please contact us.vehicleType
- The vehicle type
for the driver.public ZendriveDriverAttributes.ServiceLevel getServiceLevel()
public void setCustomAttribute(String key, String value)
Up to 4 custom attributes can be set for a driver.
key
- A key for the custom attribute.value
- Value of the custom attribute.IllegalStateException
- if max custom attributes (4) are already specified.public String getAlias()
public String getGroup()
@Nullable public ZendriveVehicleType getVehicleType()
public String getCustomAttribute(String key)
public String getJsonForUpload()
public JSONObject toJson()