package com.openxc.messages;

import java.util.Map;

import android.os.Parcel;

import com.openxc.measurements.UnrecognizedMeasurementTypeException;

public class NamedVehicleMessage extends VehicleMessage {

    private String mName;

    public NamedVehicleMessage(String name) {
        this(name, null);
    }

    public NamedVehicleMessage(Map<String, Object> values) {
        super(values);
        mName = (String)getValuesMap().remove(NAME_KEY);
    }

    public NamedVehicleMessage(String name, Map<String, Object> values) {
        super(values);
        mName = name;
    }

    public NamedVehicleMessage(Long timestamp, String name, Map<String, Object> values) {
        super(timestamp, values);
        mName = name;
    }

    public String getName() {
        return mName;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj == null || !super.equals(obj)) {
            return false;
        }

        final NamedVehicleMessage other = (NamedVehicleMessage) obj;
        return super.equals(other) && mName.equals(other.mName);
    }

    @Override
    public void writeToParcel(Parcel out, int flags) {
        super.writeToParcel(out, flags);
        out.writeString(getName());
    }

    @Override
    protected void readFromParcel(Parcel in) {
        super.readFromParcel(in);
        mName = in.readString();
    }

    private NamedVehicleMessage(Parcel in)
            throws UnrecognizedMeasurementTypeException {
        this();
        readFromParcel(in);
    }

    protected NamedVehicleMessage() { }
}

@@ -73,16 +73,56 @@
 arcel;%0A%0A
+import com.google.common.base.Objects;%0A%0A
 import c
@@ -1106,32 +1106,278 @@
 .mName);%0A    %7D%0A%0A
+    @Override%0A    public String toString() %7B%0A        return Objects.toStringHelper(this)%0A            .add(%22timestamp%22, getTimestamp())%0A            .add(%22name%22, getName())%0A            .add(%22values%22, getValuesMap())%0A            .toString();%0A    %7D%0A%0A
     @Override%0A  

Add a more specific toString to NamedVehicleMessage.