com.huawei.openstack4j.openstack.identity.v3.domain.KeystoneGroup Maven / Gradle / Ivy
/*******************************************************************************
* Copyright 2016 ContainX and OpenStack4j
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*******************************************************************************/
package com.huawei.openstack4j.openstack.identity.v3.domain;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.huawei.openstack4j.model.identity.v3.Group;
import com.huawei.openstack4j.model.identity.v3.builder.GroupBuilder;
import com.huawei.openstack4j.openstack.common.ListResult;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
/**
* group model class for identity/v3
*
* @see API reference
*/
@JsonRootName("group")
@JsonIgnoreProperties(ignoreUnknown = true)
public class KeystoneGroup implements Group {
private static final long serialVersionUID = 1L;
private String id;
@JsonProperty("domain_id")
private String domainId;
private String name;
private String description;
private Map links;
/**
* @return the group builder
*/
public static GroupBuilder builder() {
return new GroupConcreteBuilder();
}
@Override
public GroupBuilder toBuilder() {
return new GroupConcreteBuilder(this);
}
/**
* {@inheritDoc}
*/
@Override
public String getId() {
return id;
}
/**
* {@inheritDoc}
*/
@Override
public String getName() {
return name;
}
/**
* {@inheritDoc}
*/
@Override
public String getDescription() {
return description;
}
/**
* {@inheritDoc}
*/
@Override
public String getDomainId() {
return domainId;
}
/**
* {@inheritDoc}
*/
@Override
public Map getLinks() {
return links;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
return MoreObjects.toStringHelper(this).omitNullValues()
.add("id", id)
.add("name", name)
.add("description", description)
.add("links", links)
.add("domainId", domainId)
.toString();
}
/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
return Objects.hashCode(id, name, description, links, domainId);
}
/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null || getClass() != obj.getClass())
return false;
KeystoneGroup that = KeystoneGroup.class.cast(obj);
return Objects.equal(this.id, that.id)
&& Objects.equal(this.domainId, that.domainId)
&& Objects.equal(this.description, that.description)
&& Objects.equal(this.name, that.name)
&& Objects.equal(this.links, that.links);
}
public static class GroupConcreteBuilder implements GroupBuilder {
KeystoneGroup model;
GroupConcreteBuilder() {
this(new KeystoneGroup());
}
GroupConcreteBuilder(KeystoneGroup model) {
this.model = model;
}
@Override
public Group build() {
return model;
}
/**
* {@inheritDoc}
*/
@Override
public GroupBuilder from(Group in) {
if (in != null)
this.model = (KeystoneGroup) in;
return this;
}
/**
* @see KeystoneGroup#getId()
*/
@Override
public GroupBuilder id(String id) {
model.id = id;
return this;
}
/**
* @see KeystoneGroup#getName()
*/
@Override
public GroupBuilder name(String name) {
model.name = name;
return this;
}
/**
* @see KeystoneGroup#getDescription()()
*/
@Override
public GroupBuilder description(String description) {
model.description = description;
return this;
}
/**
* @see KeystoneGroup#getDomainId()
*/
@Override
public GroupBuilder domainId(String domainId) {
model.domainId = domainId;
return this;
}
/**
* @see KeystoneGroup#getLinks()
*/
@Override
public GroupBuilder links(Map links) {
model.links = links;
return this;
}
}
public static class Groups extends ListResult {
private static final long serialVersionUID = 1L;
@JsonProperty("groups")
protected List list;
@Override
public List value() {
return list;
}
}
}