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 ofIdPAttributeare 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 Map<Locale,String>displayDescriptionsLocalized human readable descriptions of attribute.private Map<Locale,String>displayNamesLocalized human intelligible attribute names.private static Function<Map.Entry<Locale,String>,Map.Entry<Locale,String>>filterEntryHelper Function for map manipulation.private StringidID of this attribute.private static org.slf4j.LoggerLOGLogger - static.private static Predicate<String>SPACE_CONTAININGValue for testing illegal name.private List<IdPAttributeValue>valuesValues for this attribute.
-
Constructor Summary
Constructors Constructor Description IdPAttribute(String attributeId)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private Map<Locale,String>checkedNamesFrom(Map<Locale,String> inputMap)Process input tosetDisplayNames(Map)and {setDisplayDescriptions(Map)to strip out null input, null keys, and null values.IdPAttributeclone()Clones an attribute.intcompareTo(IdPAttribute other)booleanequals(Object obj)Map<Locale,String>getDisplayDescriptions()Gets the localized human readable description of attribute.Map<Locale,String>getDisplayNames()Gets the localized human readable name of the attribute.StringgetId()Gets the unique ID of the attribute.List<IdPAttributeValue>getValues()Get the unmodifiable ordered collection of values of the attribute.inthashCode()static booleanisDeprecatedId(String id)Centralized method to police deprecated Identifiers.static booleanisInvalidId(String id)Centralized method to police invalid Identifiers.voidsetDisplayDescriptions(Map<Locale,String> newDescriptions)Replaces the existing display descriptions for this attribute with the given ones.voidsetDisplayNames(Map<Locale,String> newNames)Replaces the existing display names for this attribute with the given ones.voidsetValues(Collection<IdPAttributeValue> newValues)Replaces the existing values for this attribute with the given values.StringtoString()
-
-
-
Field Detail
-
SPACE_CONTAINING
private static final Predicate<String> SPACE_CONTAINING
Value for testing illegal name.
-
LOG
@Nonnull private static final org.slf4j.Logger LOG
Logger - static.
-
filterEntry
@Nonnull private static Function<Map.Entry<Locale,String>,Map.Entry<Locale,String>> filterEntry
Helper Function for map manipulation.
-
id
@Nonnull private final String id
ID of this attribute.
-
displayNames
@Nonnull private Map<Locale,String> displayNames
Localized human intelligible attribute names.
-
displayDescriptions
@Nonnull private Map<Locale,String> displayDescriptions
Localized human readable descriptions of attribute.
-
values
@Nonnull private List<IdPAttributeValue> values
Values for this attribute.
-
-
Constructor Detail
-
IdPAttribute
public IdPAttribute(@Nonnull @NotEmpty @ParameterName(name="attributeId") String attributeId)
Constructor.- Parameters:
attributeId- unique identifier of the attribute
-
-
Method Detail
-
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
-
getDisplayNames
@Nonnull @NonnullElements @Unmodifiable public Map<Locale,String> getDisplayNames()
Gets the localized human readable name of the attribute.- Returns:
- human readable name of the attribute
-
checkedNamesFrom
@Nonnull @Unmodifiable private final Map<Locale,String> checkedNamesFrom(@Nonnull @NonnullElements Map<Locale,String> inputMap)
Process input tosetDisplayNames(Map)and {setDisplayDescriptions(Map)to strip out null input, null keys, and null values.- Parameters:
inputMap- the input map.- Returns:
- the unmodifiable, non null-containing output.
-
setDisplayNames
public void setDisplayNames(@Nonnull @NonnullElements Map<Locale,String> newNames)
Replaces the existing display names for this attribute with the given ones.- Parameters:
newNames- the new names for this attribute
-
getDisplayDescriptions
@Nonnull @NonnullElements @Unmodifiable public Map<Locale,String> getDisplayDescriptions()
Gets the localized human readable description of attribute.- Returns:
- human readable description of attribute
-
setDisplayDescriptions
public void setDisplayDescriptions(@Nonnull @NonnullElements Map<Locale,String> newDescriptions)
Replaces the existing display descriptions for this attribute with the given ones.- Parameters:
newDescriptions- the new descriptions for this attribute
-
getValues
@Nonnull @NonnullElements @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 Collection<IdPAttributeValue> newValues)
Replaces the existing values for this attribute with the given values.- Parameters:
newValues- the new values for this attribute
-
compareTo
public int compareTo(IdPAttribute other)
- Specified by:
compareToin interfaceComparable<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:
clonein classObject- Throws:
CloneNotSupportedException
-
-