package com.blueliv.common;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

/**
 * Represents an error message with all the data needed to be showed to users
 * @author Jordi
 *
 */
@XmlType(propOrder ={"field","messageKey","messageParams"})
@XmlRootElement
public class ErrorMessage{
	/**
	 * Field not validating
	 */
	String field;
	/**
	 * Key to retrieve from a bundle
	 */
	String messageKey;
	/**
	 * params for the message in the bundle
	 */
	String[] messageParams;
	
	ErrorMessage(){}
	public ErrorMessage(String messageKey,String field,String... messageParams){
		this.messageKey = messageKey;
		this.field = field;
		this.messageParams = messageParams;
	}


	@XmlElement
	public String getField(){
		return field;
	}
	
	@XmlElement
	public String getMessageKey(){
		return messageKey;
	}

	@XmlElement
	public String[] getMessageParams(){
		return messageParams;
	}
}
