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

com.unboundid.scim.sdk.ComplexSCIMAttributeValue Maven / Gradle / Ivy

Go to download

The UnboundID SCIM SDK is a library that may be used to interact with various types of SCIM-enabled endpoints (such as the UnboundID server products) to perform lightweight, cloud-based identity management via the SCIM Protocol. See http://www.simplecloud.info for more information.

There is a newer version: 1.8.26
Show newest version
/*
 * Copyright 2014-2016 UnboundID Corp.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License (GPLv2 only)
 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see .
 */

package com.unboundid.scim.sdk;

import java.util.Map;

/**
 * SCIMAttributeValue implementation for a complex attribute value.
 */
class ComplexSCIMAttributeValue extends SCIMAttributeValue
{
  /**
   * The attributes comprising the complex value, keyed by the lower case
   * name of the attribute, or {@code null} if the attribute value is simple.
   */
  private final Map attributes;


  /**
   * Create a new instance of a SCIM complex attribute value.
   *
   * @param attributes  The attributes comprising the complex value, keyed by
   *                    the name of the attribute.
   */
  ComplexSCIMAttributeValue(final Map attributes)
  {
    this.attributes = attributes;
  }


  /**
   * Determines whether this attribute value is simple or complex.
   *
   * @return  {@code true} if this attribute value is complex, or
   *          {@code false} otherwise.
   */
  public boolean isComplex()
  {
    return true;
  }


  /**
   * Retrieves the attributes comprising the complex value, keyed by the lower
   * case name of the attribute, or {@code null} if the attribute value is
   * simple.
   *
   * @return  The attributes comprising the complex value.
   */
  public Map getAttributes()
  {
    return attributes;
  }


  /**
   * Retrieves the simple value, or {@code null} if the attribute value is
   * complex.
   *
   * @return  The simple value, or {@code null} if the attribute value is
   * complex.
   */
  public SimpleValue getValue()
  {
    return null;
  }


  /**
   * {@inheritDoc}
   */
  @Override
  public String toString()
  {
    final StringBuilder sb = new StringBuilder();
    sb.append("ComplexSCIMAttributeValue{");
    sb.append("attributes=").append(attributes);
    sb.append('}');
    return sb.toString();
  }


  /**
   * {@inheritDoc}
   */
  @Override
  public boolean equals(final Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || !(o instanceof
        com.unboundid.scim.sdk.ComplexSCIMAttributeValue)) {
      return false;
    }

    com.unboundid.scim.sdk.ComplexSCIMAttributeValue that =
        (com.unboundid.scim.sdk.ComplexSCIMAttributeValue) o;

    if (attributes != null ? !attributes.equals(that.attributes) :
        that.attributes != null) {
      return false;
    }

    return true;
  }


  /**
   * {@inheritDoc}
   */
  @Override
  public int hashCode() {
    return attributes != null ? attributes.hashCode() : 0;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy