package org.perfectable.visuable.visual;

public final class StringIdentifier implements Visual.Identifier {

	private static final long serialVersionUID = -3837459117766391558L;

	public static final String PREFIX = "vx-";

	private final String code;

	public static StringIdentifier of(String code) {
		return new StringIdentifier(code);
	}

	private StringIdentifier(String code) {
		this.code = code;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (!(obj instanceof StringIdentifier)) {
			return false;
		}
		StringIdentifier other = (StringIdentifier) obj;
		return this.code.equals(other.code);
	}

	@Override
	public int hashCode() {
		return this.code.hashCode();
	}

	@Override
	public String toString() {
		return this.code;
	}

}
