package com.bqreaders.lib.token.model;

import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Objects;

import org.apache.commons.lang.ArrayUtils;
import org.springframework.data.annotation.Id;

/**
 * @author Alberto J. Rubio
 * 
 */
public class OneTimeAccessToken {

	@Id
	private final String id;
	private final Date expireAt;
	private final List<String> tags;

    public OneTimeAccessToken(String id, Date expireAt, List<String> tags) {
        this.id = id;
        this.expireAt = expireAt;
        this.tags = tags.isEmpty() ? null : tags;
    }

	public String getId() {
		return id;
	}

	public Date getExpireAt() {
		return expireAt;
	}

	public List<String> getTags() {
		return tags;
	}

	@Override
	public int hashCode() {
		return Objects.hash(id, expireAt);
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null || !(obj instanceof OneTimeAccessToken)) {
			return false;
		}
		OneTimeAccessToken that = (OneTimeAccessToken) obj;
		return Objects.equals(this.id, that.id) && Objects.equals(this.expireAt, that.expireAt);
	}

}

@@ -37,33 +37,8 @@
 l;%0A%0A
-import java.util.Arrays;%0A
 impo
@@ -110,51 +110,8 @@
 s;%0A%0A
-import org.apache.commons.lang.ArrayUtils;%0A
 impo
@@ -482,36 +482,148 @@
 s = 
-tags.isEmpty() ? null : tags
+isEmptyList(tags) ? null : tags;%0A    %7D%0A%0A    private boolean isEmptyList(List%3CString%3E list) %7B%0A        return list == null %7C%7C list.size() == 0
 ;%0A  
@@ -627,17 +627,20 @@
 %0A    %7D%0A%0A
-%09
+    
 public S

Fix null pointer exception