Package net.shibboleth.idp.consent.logic.impl

# Class AbstractAttributeDisplayFunction

java.lang.Object
net.shibboleth.idp.consent.logic.impl.AbstractAttributeDisplayFunction

All Implemented Interfaces:
  `Function<IdPAttribute,String>`

Direct Known Subclasses:
  `AttributeDisplayDescriptionFunction`, `AttributeDisplayNameFunction`

public abstract class AbstractAttributeDisplayFunction extends Object implements Function<IdPAttribute,String>
Abstract Function which returns `Locale`-aware information about an attribute. The abstract method `getDisplayInfo(AttributeTranscoderRegistry, IdPAttribute)` returns the information selected for the attribute from the transcoder. This function defaults to returning the attribute ID if no information is selected from the attribute for the desired locales.

## Field Summary

Fields
Modifier and Type
Field
Description
`private Map<IdPAttribute,Map<Locale,String>>`
`cachedInfo`
Cache of already looked up values.
`private final List<Locale.LanguageRange>`
`defaultLanguageRange`
The tags for the fallback languages.
`private final List<Locale.LanguageRange>`
`languageRange`
The range of locales from the request.
`private ReloadableService<AttributeTranscoderRegistry>`
`transcoder`
How to do the lookup.

## Constructor Summary

Constructors
Constructor
Description
`AbstractAttributeDisplayFunction(HttpServletRequest request, List<String> defaultLanguages, ReloadableService<AttributeTranscoderRegistry> transcoderService)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`String`
`apply(IdPAttribute input)`
`protected abstract Map<Locale,String>`
`getDisplayInfo(AttributeTranscoderRegistry registry, IdPAttribute attribute)`
Get the information to be displayed from the attribute.

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

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

### Methods inherited from interface java.util.function.Function

`andThen, compose`

## Field Details

### languageRange

@Nonnull @Unmodifiable private final List<Locale.LanguageRange> languageRange
The range of locales from the request.

### defaultLanguageRange

@Nonnull @Unmodifiable private final List<Locale.LanguageRange> defaultLanguageRange
The tags for the fallback languages.

### cachedInfo

@Nonnull private Map<IdPAttribute,Map<Locale,String>> cachedInfo
Cache of already looked up values.

### transcoder

@Nonnull private ReloadableService<AttributeTranscoderRegistry> transcoder
How to do the lookup.

## Constructor Details

### AbstractAttributeDisplayFunction

public AbstractAttributeDisplayFunction(@Nonnull HttpServletRequest request, @Nullable List<String> defaultLanguages, ReloadableService<AttributeTranscoderRegistry> transcoderService)
Constructor.

Parameters:
  `request` - `HttpServletRequest` used to get preferred languages
  `defaultLanguages` - list of fallback languages in order of decreasing preference
  `transcoderService` - the attribute transcoder service

## Method Details

### apply

@Nullable public String apply(@Nullable IdPAttribute input)

Specified by:
  `apply` in interface `Function<IdPAttribute,String>`

### getDisplayInfo

@Nonnull protected abstract Map<Locale,String> getDisplayInfo(@Nonnull AttributeTranscoderRegistry registry, @Nonnull IdPAttribute attribute)
Get the information to be displayed from the attribute.

Parameters:
  `registry` - the `AttributeTranscoderRegistry` to ask.
  `attribute` - the attribute to consider
Returns:
  the map of locale dependent information to be displayed