package edu.upc.caminstech.equipstic;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonInclude(Include.NON_NULL)
public class Marca {

    private final long idMarca;
    private final String nom;

    @JsonCreator
    public Marca( //
            @JsonProperty(value = "idMarca", required = true) long idMarca, //
            @JsonProperty(value = "nom", required = false) String nom) {

        this.idMarca = idMarca;
        this.nom = nom;
    }

    public Marca(long idMarca) {
        this(idMarca, null);
    }

    public long getIdMarca() {
        return idMarca;
    }

    public String getNom() {
        return nom;
    }

    @Override
    public String toString() {
        return String.format("[Marca idMarca: %s, nom: %s]", idMarca, nom);
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof Marca)) {
            return false;
        }
        return this.idMarca == ((Marca) obj).idMarca;
    }

    @Override
    public int hashCode() {
        return Long.hashCode(idMarca);
    }

}

@@ -32,16 +32,62 @@
 pstic;%0A%0A
+import org.apache.commons.lang3.StringUtils;%0A%0A
 import c
@@ -658,19 +658,37 @@
 s.nom = 
+StringUtils.trim(
 nom
+)
 ;%0A    %7D%0A

trim Marca names