All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.imunity.scim.group.GroupMember Maven / Gradle / Ivy

There is a newer version: 4.0.3
Show newest version
/*
 * Copyright (c) 2021 Bixbit - Krzysztof Benedyczak. All rights reserved.
 * See LICENCE.txt file for licensing information.
 */

package io.imunity.scim.group;

import java.util.Objects;

class GroupMember
{
	enum MemberType
	{
		Group, User
	};

	final String value;
	final String displayName;
	final MemberType type;

	private GroupMember(Builder builder)
	{
		this.value = builder.value;
		this.displayName = builder.displayName;
		this.type = builder.type;
	}

	@Override
	public int hashCode()
	{
		return Objects.hash(displayName, type, value);
	}

	@Override
	public boolean equals(Object obj)
	{
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		GroupMember other = (GroupMember) obj;
		return Objects.equals(displayName, other.displayName) && type == other.type
				&& Objects.equals(value, other.value);
	}

	static Builder builder()
	{
		return new Builder();
	}

	static final class Builder
	{
		private String value;
		private String displayName;
		private MemberType type;

		private Builder()
		{
		}

		Builder withValue(String value)
		{
			this.value = value;
			return this;
		}

		Builder withDisplayName(String displayName)
		{
			this.displayName = displayName;
			return this;
		}

		Builder withType(MemberType type)
		{
			this.type = type;
			return this;
		}

		GroupMember build()
		{
			return new GroupMember(this);
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy