Package net.shibboleth.idp.attribute

# Class IdPAttribute

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

All Implemented Interfaces:
  `Cloneable`, `Comparable<IdPAttribute>`

Direct Known Subclasses:
  `IdPRequestedAttribute`

@NotThreadSafe public class IdPAttribute extends Object implements Comparable<IdPAttribute>, Cloneable
Each attribute represents one piece of information about a user and has associated encoders used to turn that information in to protocol-specific formats. Instances of `IdPAttribute` are compared using their IDs. That is, two attributes are considered the same if they have the same ID, regardless of whether their display names, descriptions, values, or encoders are the same.

## Field Summary

Fields
Modifier and Type
Field
Description
`private final String`
`id`
ID of this attribute.
`private static final org.slf4j.Logger`
`LOG`
Logger - static.
`private static final Predicate<String>`
`SPACE_CONTAINING`
Value for testing illegal name.
`private List<IdPAttributeValue>`
`values`
Values for this attribute.

## Constructor Summary

Constructors
Constructor
Description
`IdPAttribute(String attributeId)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`IdPAttribute`
`clone()`
Clones an attribute.
`int`
`compareTo(IdPAttribute other)`
`boolean`
`contains(String value)`
Check for a string value amongst this object's value collection.
`boolean`
`equals(Object obj)`
Note that for historic reasons IdPAttribute equality is based only on the Identifier (the values are no looked at) See JSATTR-45 for why.
`String`
`getId()`
Gets the unique ID of the attribute.
`List<IdPAttributeValue>`
`getValues()`
Get the unmodifiable ordered collection of values of the attribute.
`int`
`hashCode()`
`static boolean`
`isDeprecatedId(String id)`
Centralized method to police deprecated Identifiers.
`static boolean`
`isInvalidId(String id)`
Centralized method to police invalid Identifiers.
`void`
`setValues(List<IdPAttributeValue> newValues)`
Replaces the existing values for this attribute with the given values.
`String`
`toString()`

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

`finalize, getClass, notify, notifyAll, wait, wait, wait`

## Field Details

### SPACE_CONTAINING

@Nonnull private static final Predicate<String> SPACE_CONTAINING
Value for testing illegal name.

### LOG

@Nonnull private static final org.slf4j.Logger LOG
Logger - static.

### id

@Nonnull private final String id
ID of this attribute.

### values

@Nonnull private List<IdPAttributeValue> values
Values for this attribute.

## Constructor Details

### IdPAttribute

public IdPAttribute(@Nonnull @NotEmpty @ParameterName(name="attributeId") String attributeId)
Constructor.

Parameters:
  `attributeId` - unique identifier of the attribute

## Method Details

### isDeprecatedId

public static boolean isDeprecatedId(@Nonnull @NotEmpty String id)
Centralized method to police deprecated Identifiers.

Parameters:
  `id` - what to test
Returns:
  whether the name is currently deprecated.

### isInvalidId

public static boolean isInvalidId(@Nullable String id)
Centralized method to police invalid Identifiers.

Parameters:
  `id` - what to test
Returns:
  whether the name is disallowed.

### getId

@Nonnull @NotEmpty public String getId()
Gets the unique ID of the attribute. This ID need not be related to any protocol-specific attribute identifiers.

Returns:
  unique ID of the attribute

### getValues

@Nonnull @Unmodifiable @NotLive public List<IdPAttributeValue> getValues()
Get the unmodifiable ordered collection of values of the attribute.

Returns:
  values of the attribute

### setValues

public void setValues(@Nullable @NullableElements List<IdPAttributeValue> newValues)
Replaces the existing values for this attribute with the given values.

Nulls are replaced inline by an `EmptyAttributeValue` suitably initialized.

Parameters:
  `newValues` - the new values for this attribute

### contains

public boolean contains(@Nonnull @NotEmpty String value)
Check for a string value amongst this object's value collection.

Parameters:
  `value` - value to check for
Returns:
  true iff a `StringAttributeValue` exists with the input value
Since:
  4.3.0

### compareTo

public int compareTo(IdPAttribute other)

Specified by:
  `compareTo` in interface `Comparable<IdPAttribute>`

### clone

@Nonnull public IdPAttribute clone() throws CloneNotSupportedException
Clones an attribute. The clone will contains defensive copies of this objects display descriptions and names, encoders, and values. The elements of each collection, however, are not themselves cloned.

Overrides:
  `clone` in class `Object`
Throws:
  `CloneNotSupportedException`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### equals

public boolean equals(Object obj)
Note that for historic reasons IdPAttribute equality is based only on the Identifier (the values are no looked at) See JSATTR-45 for why.

Overrides:
  `equals` in class `Object`

### toString

@Nonnull public String toString()

Overrides:
  `toString` in class `Object`