Feature request - custom attributes


Could you please consider adding a custom properties property to pickups/deliveries/vehicles/drivers etc.

IE job.setCustomProperties and job.getCustomProperties

This could be as simple as a String that a value can be stored in or a list that a list of values could be stored. The string would be easiest to implement and the programmer could store the values as a JSON string in the string field.

This would be very useful in constraints etc.

An example of how we could use this would be “depot=true” on some pickups and deliveries where we need to know if the location is a depot when making a decision in a constraint.

By making it a string the programmer can keep anything in there.

Does this make sense ?


I have created this in “issues” as I noted Stefan commented to someone else.


Almost agree, but the properties should be a Map<String,Object>, instead of Map<String,String> to avoid unnecessary, repeated string parsing and it may offer some typed getters (getAsObject, getAsString, getAsInt, getAsBoolean, etc) which may throw exception in case of incompatible class cast, to keep the main code clean.

Alternatively – and maybe even more preferably – I propose to use a single Object type userData field to contain the info. It would let the user to assign any type of data object with exactly the fields it needs. Its safer and cleaner then untyped maps. If the getter of user data is made generic, a single unsafe cast is enough to handle type. (Sidenote: Using generic in class would be a bad idea, because it would be tiresome to bring through whole the code and the type info would be lost anyway within engine code).