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

io.imunity.scim.config.SchemaWithMapping 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.config;

import java.util.Collections;
import java.util.List;
import java.util.Objects;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;

@JsonDeserialize(builder = SchemaWithMapping.Builder.class)
public class SchemaWithMapping
{
	public final String id;
	public final SchemaType type;
	public final String name;
	public final String description;
	public final boolean enable;
	public final List attributesWithMapping;

	private SchemaWithMapping(Builder builder)
	{
		this.id = builder.id;
		this.type = builder.type;
		this.name = builder.name;
		this.description = builder.description;
		this.enable = builder.enable;
		this.attributesWithMapping = List.copyOf(builder.attributes);
	}

	@Override
	public int hashCode()
	{
		return Objects.hash(attributesWithMapping, description, id, name, enable, type);
	}

	@Override
	public boolean equals(Object obj)
	{
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SchemaWithMapping other = (SchemaWithMapping) obj;
		return Objects.equals(attributesWithMapping, other.attributesWithMapping)
				&& Objects.equals(description, other.description) && Objects.equals(id, other.id)
				&& Objects.equals(name, other.name) && Objects.equals(enable, other.enable) && Objects.equals(type, other.type);
	}

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

	public static final class Builder
	{
		private String id;
		private String name;
		private String description;
		private boolean enable;
		private List attributes = Collections.emptyList();
		private SchemaType type;
		
		private Builder()
		{
		}

		public Builder withId(String id)
		{
			this.id = id;
			return this;
		}
		
		public Builder withType(SchemaType type)
		{
			this.type = type;
			return this;
		}

		public Builder withName(String name)
		{
			this.name = name;
			return this;
		}

		public Builder withDescription(String description)
		{
			this.description = description;
			return this;
		}

		public Builder withEnable(boolean enable)
		{
			this.enable = enable;
			return this;
		}

		public Builder withAttributesWithMapping(List attributes)
		{
			this.attributes = attributes;
			return this;
		}

		public SchemaWithMapping build()
		{
			return new SchemaWithMapping(this);
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy