Package net.shibboleth.idp.attribute

# Class IdPAttributeSupport

java.lang.Object
net.shibboleth.idp.attribute.IdPAttributeSupport

public final class IdPAttributeSupport extends Object
Class for general support functions for managing `IdPAttribute` objects.

Since:
  5.2.0

## Constructor Summary

Constructors
Modifier
Constructor
Description
`private`
`IdPAttributeSupport()`
Private constructor.

## Method Summary

Modifier and Type
Method
Description
`static Map<String,IdPAttribute>`
`toMapMergeDuplicates(Collection<IdPAttribute> attributes)`
Convert a collection of `IdPAttribute` objects into a mutable `Map` keyed by `IdPAttribute.getId()`.
`static Map<String,IdPAttribute>`
`toMapNoDuplicates(Collection<IdPAttribute> attributes)`
Convert a collection of `IdPAttribute` objects into a mutable `Map` keyed by `IdPAttribute.getId()`.
`static Map<String,IdPAttribute>`
`withMapMergeDuplicates(Map<String,IdPAttribute> existingAttributes, Collection<IdPAttribute> newAttributes)`
Add a collection of `IdPAttribute` objects into a mutable input `Map` keyed by `IdPAttribute.getId()`.
`static Map<String,IdPAttribute>`
`withMapMergeDuplicates(Map<String,IdPAttribute> existingAttributes, Map<String,IdPAttribute> newAttributes)`
Add a collection of `IdPAttribute` objects into a mutable input `Map` keyed by `IdPAttribute.getId()`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### IdPAttributeSupport

private IdPAttributeSupport()
Private constructor.

## Method Details

### toMapNoDuplicates

@Nonnull @Live public static Map<String,IdPAttribute> toMapNoDuplicates(@Nullable Collection<IdPAttribute> attributes)
Convert a collection of `IdPAttribute` objects into a mutable `Map` keyed by `IdPAttribute.getId()`.

If an attribute with a duplicate ID is found, then we issue a warning and an arbitrary one is chosen.

Parameters:
  `attributes` - collection of attributes
Returns:
  the input attributes in a map keyed by `IdPAttribute.getId()`

### toMapMergeDuplicates

@Nonnull @Live public static Map<String,IdPAttribute> toMapMergeDuplicates(@Nullable Collection<IdPAttribute> attributes)
Convert a collection of `IdPAttribute` objects into a mutable `Map` keyed by `IdPAttribute.getId()`.

If an attribute with a duplicate ID is found, then we merge the values into a single attribute.

Parameters:
  `attributes` - collection of attributes
Returns:
  the input attributes in a map keyed by `IdPAttribute.getId()`

### withMapMergeDuplicates

@Nonnull @Live public static Map<String,IdPAttribute> withMapMergeDuplicates(@Nonnull @Live Map<String,IdPAttribute> existingAttributes, @Nonnull Map<String,IdPAttribute> newAttributes)
Add a collection of `IdPAttribute` objects into a mutable input `Map` keyed by `IdPAttribute.getId()`.

If an attribute with a duplicate ID is found, then we merge the values into a single attribute.

Parameters:
  `existingAttributes` - an existing mutable map to merge into
  `newAttributes` - collection to merge into map
Returns:
  the input map after merging is done

### withMapMergeDuplicates

@Nonnull @Live public static Map<String,IdPAttribute> withMapMergeDuplicates(@Nonnull @Live Map<String,IdPAttribute> existingAttributes, @Nullable Collection<IdPAttribute> newAttributes)
Add a collection of `IdPAttribute` objects into a mutable input `Map` keyed by `IdPAttribute.getId()`.

If an attribute with a duplicate ID is found, then we merge the values into a single attribute.

Parameters:
  `existingAttributes` - an existing mutable map to merge into
  `newAttributes` - collection to merge into map
Returns:
  the input map after merging is done