Class ComplexAttribute<T extends ComplexAttributeValue<T>>

Object
se.curity.identityserver.sdk.attribute.Attribute
se.curity.identityserver.sdk.attribute.scim.v2.ComplexAttribute<T>
Type Parameters:
T - Type of Attribute
All Implemented Interfaces:
Iterable<AttributeValue>, AttributeOrAttributeValue<Attribute>

public class ComplexAttribute<T extends ComplexAttributeValue<T>> extends Attribute
Attribute whose value is a collection of objects, used to represent the Complex Attribute of SCIM.

The json representation of the attribute value is an array of objects

Example phoneNumbers:

  "phoneNumbers": [
      {
          "type": "work",
          "value: "+46771793336",
          "primary": true
      },
      {
          "type": "home",
          "value": "+4681234321"
      }
  ]
 
  • Method Details

    • complexAttributeOf

      public static <V extends ComplexAttributeValue<V>> ComplexAttribute<V> complexAttributeOf(String name, List<V> values)
    • of

      public static <V extends ComplexAttributeValue<V>> ComplexAttribute<V> of(AttributeName attributeName, ListAttributeValue attributeValues, String authority, Function<MapAttributeValue,V> factory)
    • getItems

      public List<T> getItems()
    • getPrimary

      @Nullable public T getPrimary()
      Get the attribute marked as primary.
      Returns:
      the primary attribute
    • getAttributeValue

      public ListAttributeValue getAttributeValue()
      Description copied from class: Attribute
      Returns the attribute's value.
      Overrides:
      getAttributeValue in class Attribute
      Returns:
      the value of this attribute.
    • size

      public int size()
      Get the size of the collection.
      Returns:
      int size
    • toList

      public List<T> toList()
      Move the attributes to a list.
      Returns:
      list of T
    • get

      @Nullable public T get(int index)
      Get an object based on the index.
      Parameters:
      index - the index
      Returns:
      the object, or null if not found
    • getByType

      @Nullable public T getByType(String type)
      Get an attribute based on the type parameter of the attribute.
      Parameters:
      type - the type to lookup
      Returns:
      The first found attribute with the given type, or null if not found
      See Also:
    • remove

      public ComplexAttribute<T> remove(T attribute)
      Remove an attribute from the list.
      Parameters:
      attribute - to remove. If the attribute is not found, the collection will be copied unchanged.
      Returns:
      a copy of the collection, with the attribute removed if found.
    • add

      public ComplexAttribute<T> add(T attribute)
      Add an attribute to the collection.
      Parameters:
      attribute - to add
      Returns:
      copy of the collection with the attribute added
    • getByValue

      @Nullable public T getByValue(String value)
      Get an attribute based on the value of the attribute.
      Parameters:
      value - the value to look for.
      Returns:
      The attribute that has the matching value, or null if not found.
    • getPrimaryOrFirst

      @Nullable public T getPrimaryOrFirst()
      Get the attribute marked as primary, or the first in the list if not found.
      Returns:
      The primary if found, otherwise the first. Null if the list is empty.
    • isEmpty

      public boolean isEmpty()
      Check if the collection is empty.
      Returns:
      true if the size is 0
    • withName

      public Attribute withName(String name)
      Overrides:
      withName in class Attribute
    • withName

      public Attribute withName(AttributeName name)
      Overrides:
      withName in class Attribute
    • withAuthority

      public Attribute withAuthority(String authority)
      Overrides:
      withAuthority in class Attribute