
package de.ivu.elect.jee.entity.tk;

import de.ivu.elect.jee.faces.IMessages;

public class EntityFieldValue {

  public static final String MESSAGE_KEY = "validation.technical.key.constraint.efp";

  private final String entityKey;

  private final String fieldKey;

  private final Object value;

  public EntityFieldValue(String entityKey, String fieldKey, Object value) {
    this.entityKey = entityKey;
    this.fieldKey = fieldKey;
    this.value = value;
  }

  public String getEntityKey() {
    return entityKey;
  }

  public String getFieldKey() {
    return fieldKey;
  }

  public Object getValue() {
    return value;
  }

  @Override
  public String toString() {
    return "EntityFieldValue [entityKey=" + entityKey + ", fieldKey=" + fieldKey + ", value=" + value + "]";
  }

  public String getMessage(IMessages messages) {
    return messages.getMessageForMessageKey(MESSAGE_KEY, new Object[] {messages.getMessageForMessageKey(entityKey),
        messages.getMessageForMessageKey(fieldKey), value});
  }
}
