package custom.grid.formatter;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Objects;

import property.grid.Formatter;

/**
 * @author r.latypov
 */
public class YearFormatter implements Formatter<String, Object> {

  @Override
  public String format(final Object object) {
    return object == null
           ? null
           : object instanceof Date date
             ? new SimpleDateFormat("yyyy").format(date)
             : Objects.toString(object);
  }
}
